Documentation
¶
Overview ¶
Package client contains the implementations required for plugins to act as a client. Developers typically query via the Runner interface, so they don't need to be aware of this layer.
The client is the actual entity that satisfies the interface. It sends a request to the host via RPC, decodes the response, and provides APIs for plugins.
Complex structures such as hcl.Expression and hcl.Body are sent/received as byte slices and range. Plugins and host parse the byte slice to get the original object.
Index ¶
- type Attribute
- type AttributesRequest
- type AttributesResponse
- type Backend
- type BackendRequest
- type BackendResponse
- type Block
- type BlocksRequest
- type BlocksResponse
- type Client
- func (c *Client) Backend() (*terraform.Backend, error)
- func (c *Client) EmitIssue(rule tflint.Rule, message string, location hcl.Range) error
- func (c *Client) EmitIssueOnExpr(rule tflint.Rule, message string, expr hcl.Expression) error
- func (*Client) EnsureNoError(err error, proc func() error) error
- func (c *Client) EvaluateExpr(expr hcl.Expression, ret interface{}) error
- func (c *Client) WalkModuleCalls(walker func(*terraform.ModuleCall) error) error
- func (c *Client) WalkResourceAttributes(resource, attributeName string, walker func(*hcl.Attribute) error) error
- func (c *Client) WalkResourceBlocks(resource, blockType string, walker func(*hcl.Block) error) error
- func (c *Client) WalkResources(resource string, walker func(*terraform.Resource) error) error
- type Connection
- type EmitIssueRequest
- type EvalExprRequest
- type EvalExprResponse
- type ManagedResource
- type ModuleCall
- type ModuleCallsRequest
- type ModuleCallsResponse
- type PassedProviderConfig
- type Provisioner
- type Resource
- type ResourcesRequest
- type ResourcesResponse
- type Rule
- type RuleObject
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Attribute ¶
type Attribute struct {
Name string
Expr []byte
ExprRange hcl.Range
Range hcl.Range
NameRange hcl.Range
}
Attribute is an intermediate representation of hcl.Attribute.
type AttributesRequest ¶
AttributesRequest is a request to the server-side Attributes method.
type AttributesResponse ¶
AttributesResponse is a response to the server-side Attributes method.
type Backend ¶ added in v0.3.0
type Backend struct {
Type string
Config []byte
ConfigRange hcl.Range
TypeRange hcl.Range
DeclRange hcl.Range
}
Backend is an intermediate representation of terraform.Backend.
type BackendRequest ¶ added in v0.3.0
type BackendRequest struct{}
BackendRequest is a request to the server-side Backend method.
type BackendResponse ¶ added in v0.3.0
BackendResponse is a response to the server-side Backend method.
type Block ¶
type Block struct {
Type string
Labels []string
Body []byte
BodyRange hcl.Range
DefRange hcl.Range
TypeRange hcl.Range
LabelRanges []hcl.Range
}
Block is an intermediate representation of hcl.Block.
type BlocksRequest ¶
BlocksRequest is a request to the server-side Blocks method.
type BlocksResponse ¶
BlocksResponse is a response to the server-side Blocks method.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is an RPC client for plugins.
func (*Client) Backend ¶ added in v0.3.0
Backend calls the server-side Backend method and returns the backend configuration.
func (*Client) EmitIssue ¶
EmitIssue calls the server-side EmitIssue method with the passed rule and range. You should use EmitIssueOnExpr if you want to emit an issue for an expression. This API provides a lower level interface.
func (*Client) EmitIssueOnExpr ¶
EmitIssueOnExpr calls the server-side EmitIssue method with the passed expression.
func (*Client) EnsureNoError ¶
EnsureNoError is a helper for error handling. Depending on the type of error generated by EvaluateExpr, determine whether to exit, skip, or continue. If it is continued, the passed function will be executed.
func (*Client) EvaluateExpr ¶
func (c *Client) EvaluateExpr(expr hcl.Expression, ret interface{}) error
EvaluateExpr calls the server-side EvalExpr method and reflects the response in the passed argument.
func (*Client) WalkModuleCalls ¶ added in v0.4.0
func (c *Client) WalkModuleCalls(walker func(*terraform.ModuleCall) error) error
WalkModuleCalls calls the server-side ModuleCalls method and passed the decode response to the passed function.
func (*Client) WalkResourceAttributes ¶
func (c *Client) WalkResourceAttributes(resource, attributeName string, walker func(*hcl.Attribute) error) error
WalkResourceAttributes calls the server-side Attributes method and passes the decoded response to the passed function.
type Connection ¶
Connection is an intermediate representation of terraform.Connection.
type EmitIssueRequest ¶
type EmitIssueRequest struct {
Rule *Rule
Message string
Location hcl.Range
Expr []byte
ExprRange hcl.Range
}
EmitIssueRequest is a request to the server-side EmitIssue method.
type EvalExprRequest ¶
EvalExprRequest is a request to the server-side EvalExpr method.
type EvalExprResponse ¶
EvalExprResponse is a response to the server-side EvalExpr method.
type ManagedResource ¶
type ManagedResource struct {
Connection *Connection
Provisioners []*Provisioner
CreateBeforeDestroy bool
PreventDestroy bool
IgnoreAllChanges bool
CreateBeforeDestroySet bool
PreventDestroySet bool
}
ManagedResource is an intermediate representation of terraform.ManagedResource.
type ModuleCall ¶ added in v0.4.0
type ModuleCall struct {
Name string
SourceAddr string
SourceAddrRange hcl.Range
SourceSet bool
Version string
VersionRange hcl.Range
Config []byte
ConfigRange hcl.Range
Count []byte
CountRange hcl.Range
ForEach []byte
ForEachRange hcl.Range
Providers []PassedProviderConfig
DeclRange hcl.Range
}
ModuleCall is an intermediate representation of terraform.ModuleCall.
type ModuleCallsRequest ¶ added in v0.4.0
type ModuleCallsRequest struct{}
ModuleCallsRequest is a request to the server-side ModuleCalls method.
type ModuleCallsResponse ¶ added in v0.4.0
type ModuleCallsResponse struct {
ModuleCalls []*ModuleCall
Err error
}
ModuleCallsResponse is a response to the server-side ModuleCalls method.
type PassedProviderConfig ¶ added in v0.4.0
type PassedProviderConfig struct {
InChild *terraform.ProviderConfigRef
InParent *terraform.ProviderConfigRef
}
PassedProviderConfig is an intermediate representation of terraform.PassedProviderConfig.
type Provisioner ¶
type Provisioner struct {
Type string
Config []byte
ConfigRange hcl.Range
Connection *Connection
When terraform.ProvisionerWhen
OnFailure terraform.ProvisionerOnFailure
DeclRange hcl.Range
TypeRange hcl.Range
}
Provisioner is an intermediate representation of terraform.Provisioner.
type Resource ¶
type Resource struct {
Mode terraform.ResourceMode
Name string
Type string
Config []byte
ConfigRange hcl.Range
Count []byte
CountRange hcl.Range
ForEach []byte
ForEachRange hcl.Range
ProviderConfigRef *terraform.ProviderConfigRef
Managed *ManagedResource
DeclRange hcl.Range
TypeRange hcl.Range
}
Resource is an intermediate representation of terraform.Resource.
type ResourcesRequest ¶
type ResourcesRequest struct {
Name string
}
ResourcesRequest is a request to the server-side Resources method.
type ResourcesResponse ¶
ResourcesResponse is a response to the server-side Resources method.
type Rule ¶
type Rule struct {
Data *RuleObject
}
Rule is an intermediate representation of tflint.Rule.