client

package
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 26, 2022 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FormatVersion = "0.1"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AddPipelinePolicyInput

type AddPipelinePolicyInput struct {
	RuleID     string `json:"ruleId"`
	IsPostPlan bool   `json:"isPostPlan"`
}

type AddPipelineVariableInput

type AddPipelineVariableInput struct {
	Type        string `json:"type"`
	Key         string `json:"key"`
	Value       string `json:"value"`
	Encrypted   bool   `json:"encrypted"`
	Description string `json:"description"`
}

type AddPipelineVariableOutput

type AddPipelineVariableOutput struct {
	ID string `json:"_id"`
}

type Asset

type Asset struct {
	AccountID     string          `json:"accountId"`
	ID            string          `json:"assetId"`
	Type          string          `json:"assetType"`
	Hash          string          `json:"hash"`
	State         AssetState      `json:"state"`
	InventoryItem json.RawMessage `json:"inventoryItem,omitempty"`
	StateItem     json.RawMessage `json:"stateItem,omitempty"`
}

type AssetState

type AssetState string
const (
	StateManaged   AssetState = "managed"
	StateModified  AssetState = "modified"
	StateUnmanaged AssetState = "unmanaged"
)

type Classification

type Classification struct {
	ID          string    `json:"id,omitempty"`
	ModifiedID  string    `json:"_id,omitempty"`
	AccountID   string    `json:"-"`
	Type        string    `json:"type"`
	Name        string    `json:"name"`
	Description string    `json:"description"`
	Labels      []string  `json:"labels,omitempty"`
	CreatedAt   time.Time `json:"createdAt"`
	UpdatedAt   time.Time `json:"updatedAt"`

	// The classification's Rego policy
	Rego string `json:"rego"`

	// If true, the Rego value is base64 encoded
	IsRegoEncoded bool `json:"isRegoEncoded"`
}

type ClassificationResult

type ClassificationResult struct {
	ID   string `json:"id"`
	ARN  string `json:"arn"`
	Type string `json:"type"`
}

type ClassificationsClient

type ClassificationsClient struct {
	// contains filtered or unexported fields
}

func (*ClassificationsClient) Create

func (c *ClassificationsClient) Create(input CreateClassificationInput) (
	class Classification,
	err error,
)

func (*ClassificationsClient) Delete

func (c *ClassificationsClient) Delete(id string) (err error)

func (*ClassificationsClient) List

func (c *ClassificationsClient) List(input ListClassificationsInput) (
	list []Classification,
	err error,
)

func (*ClassificationsClient) Run

func (c *ClassificationsClient) Run(id string) (
	res []ClassificationResult,
	err error,
)

func (*ClassificationsClient) Update

func (c *ClassificationsClient) Update(id string, input UpdateClassificationInput) (
	class Classification,
	err error,
)

type Client

type Client struct {
	Dragonfly       *DragonflyClient
	Classifications *ClassificationsClient
	Inventory       *InventoryClient
	// contains filtered or unexported fields
}

func New

func New(url, authHeader string) *Client

func (*Client) Authenticate

func (c *Client) Authenticate(accessKey, secretKey string) error

func (*Client) Codify

func (c *Client) Codify(provider, providerId, assetType, assetID string) (output string, err error)

func (*Client) CreateEnvironment

func (c *Client) CreateEnvironment(name, envType, owner string, labels []string) (environment Environment, err error)

func (*Client) CreateStack

func (c *Client) CreateStack(envID, name string) (stack Stack, err error)

func (*Client) DeleteEnvironment

func (c *Client) DeleteEnvironment(envId string) (message string, err error)

func (*Client) DeleteStack

func (c *Client) DeleteStack(envID, stackID string) (stack map[string]interface{}, err error)

func (*Client) GetLatestState

func (c *Client) GetLatestState(stackID string) (list State, err error)

func (*Client) GetStack

func (c *Client) GetStack(envID, stackID string) (stack map[string]interface{}, err error)

func (*Client) GetStatePolicy

func (c *Client) GetStatePolicy(stackID string) (list State, err error)

func (*Client) ListDrifts

func (c *Client) ListDrifts(onlyDelta bool, limit uint64) (list []Drift, err error)

func (*Client) ListEnvironments

func (c *Client) ListEnvironments() (list []Environment, err error)

func (*Client) ListStacks

func (c *Client) ListStacks(envID string) (list []Stack, err error)

func (*Client) ListStates

func (c *Client) ListStates(stackID string) (list []State, err error)

func (*Client) ListUsers

func (c *Client) ListUsers() (users []User, err error)

func (*Client) ShowAsset

func (c *Client) ShowAsset(assetID string) (list []Asset, err error)

func (*Client) ShowDrift

func (c *Client) ShowDrift(driftID string) (list []Asset, err error)

func (*Client) UpdateStatePolicy

func (c *Client) UpdateStatePolicy(
	stackID string,
	selected string,
	policy json.RawMessage,
) (err error)

func (*Client) UploadState

func (c *Client) UploadState(
	stackID string,
	tfState, policy json.RawMessage,
) (err error)

type CreateClassificationInput

type CreateClassificationInput struct {
	Name        string   `json:"name"`
	Type        string   `json:"type"`
	Description string   `json:"description"`
	Rego        string   `json:"code"`
	Labels      []string `json:"labels"`
}

type CreatePipelineInput

type CreatePipelineInput struct {
	Name   string   `json:"name"`
	Owner  string   `json:"owner"`
	Labels []string `json:"labels"`
}

type CreatePipelineRunInput

type CreatePipelineRunInput struct {
	UserID      string `json:"userId"`
	Description string `json:"description"`
}

type DragonflyClient

type DragonflyClient struct {
	// contains filtered or unexported fields
}

func (*DragonflyClient) AddPipelinePolicy

func (c *DragonflyClient) AddPipelinePolicy(
	pipelineID string,
	input AddPipelinePolicyInput,
) (output interface{}, err error)

func (*DragonflyClient) AddPipelineVariable

func (c *DragonflyClient) AddPipelineVariable(
	pipelineID string,
	input AddPipelineVariableInput,
) (output AddPipelineVariableOutput, err error)

func (*DragonflyClient) CreatePipeline

func (c *DragonflyClient) CreatePipeline(
	input CreatePipelineInput,
) (pipeline Pipeline, err error)

func (*DragonflyClient) CreatePipelineRun

func (c *DragonflyClient) CreatePipelineRun(
	pipelineID string,
	input CreatePipelineRunInput,
) (run PipelineRun, err error)

func (*DragonflyClient) DeletePipeline

func (c *DragonflyClient) DeletePipeline(pipelineID string) (
	deletedPipeline Pipeline,
	err error,
)

func (*DragonflyClient) DeletePipelinePolicy

func (c *DragonflyClient) DeletePipelinePolicy(pipelineID, policyID string) (
	output PipelinePolicy,
	err error,
)

func (*DragonflyClient) DeletePipelineVariable

func (c *DragonflyClient) DeletePipelineVariable(pipelineID, varID string) (
	output PipelineVariable,
	err error,
)

func (*DragonflyClient) GetPipeline

func (c *DragonflyClient) GetPipeline(pipelineID string) (
	pipeline Pipeline,
	err error,
)

func (*DragonflyClient) GetPipelineRun

func (c *DragonflyClient) GetPipelineRun(pipelineID, runID string) (
	run PipelineRun,
	err error,
)

func (*DragonflyClient) ListPipelinePolicies

func (c *DragonflyClient) ListPipelinePolicies(pipelineID string) (policies []PipelinePolicy, err error)

func (*DragonflyClient) ListPipelineRuns

func (c *DragonflyClient) ListPipelineRuns(
	pipelineID string,
	input ListPipelineRunsInput,
) (runs []PipelineRun, err error)

func (*DragonflyClient) ListPipelineVariables

func (c *DragonflyClient) ListPipelineVariables(pipelineID string) (
	variables []PipelineVariable,
	err error,
)

func (*DragonflyClient) ListPipelines

func (c *DragonflyClient) ListPipelines() (pipelines []Pipeline, err error)

func (*DragonflyClient) LockPipeline

func (c *DragonflyClient) LockPipeline(envID string) (
	env Pipeline,
	err error,
)

func (*DragonflyClient) UnlockPipeline

func (c *DragonflyClient) UnlockPipeline(envID string) (
	env Pipeline,
	err error,
)

func (*DragonflyClient) UpdatePipeline

func (c *DragonflyClient) UpdatePipeline(
	pipelineID string,
	input UpdatePipelineInput,
) (pipeline Pipeline, err error)

func (*DragonflyClient) UpdatePipelineVariable

func (c *DragonflyClient) UpdatePipelineVariable(
	pipelineID string,
	variableID string,
	input UpdatePipelineVariableInput,
) (err error)

type Drift

type Drift struct {
	AccountID string `json:"accountId"`
	ID        string `json:"driftId"`
	CreatedAt int64  `json:"createdAt"`
	Total     int64  `json:"total"`
	Unmanaged int64  `json:"unmanagedCount"`
	Managed   int64  `json:"managedCount"`
	Modified  int64  `json:"modifiedCount"`
}

func (Drift) CreationDate

func (d Drift) CreationDate() time.Time

type Environment

type Environment struct {
	ID    string `json:"id"`
	Name  string `json:"name"`
	Owner string `json:"owner,omitempty"`
}

type Implication

type Implication struct {
	FormatVersion string            `json:"format_version,omitempty"`
	Resources     []ResourceDetails `json:"resources,omitempty"`
	TotalObjects  int               `json:"total_objects,omitempty"`
}

type InventoryClient

type InventoryClient struct {
	// contains filtered or unexported fields
}

func (*InventoryClient) NewSearchInput

func (c *InventoryClient) NewSearchInput(query string) (map[string]interface{}, error)

func (*InventoryClient) SearchInventory

func (c *InventoryClient) SearchInventory(input map[string]interface{}) (result InventorySearchResult, err error)

type InventorySearchResult

type InventorySearchResult struct {
	Aggregations    map[string]interface{} `json:"aggregations"`
	ResponseObjects []Resource             `json:"responseObjects"`
	TotalObjects    int                    `json:"totalObjects"`
}

type ListClassificationsInput

type ListClassificationsInput struct {
	DecodeRego bool
}

type ListPipelineRunsInput

type ListPipelineRunsInput struct {
	Page  int
	Limit int
}

type Pipeline

type Pipeline struct {
	ID               string                `json:"id"`
	AccountID        string                `json:"-"`
	Name             string                `json:"name"`
	AutoApprove      bool                  `json:"autoApprove"`
	Configured       bool                  `json:"configured"`
	IsLocked         bool                  `json:"isLocked"`
	IsTerragrunt     bool                  `json:"isTerragrunt"`
	Labels           []string              `json:"labels"`
	Owner            string                `json:"owner"`
	RunID            string                `json:"runId"`
	TerraformVersion string                `json:"terraformVersion"`
	CreatedAt        time.Time             `json:"createdAt"`
	UpdatedAt        time.Time             `json:"updatedAt"`
	VCS              PipelineVCS           `json:"vcs,omitempty"`
	FailurePolicy    PipelineFailurePolicy `json:"policy,omitempty"`
}

type PipelineFailurePolicy

type PipelineFailurePolicy struct {
	FailOnWarn bool `json:"failOnWarn"`
	NoFail     bool `json:"noFail"`
}

type PipelinePolicy

type PipelinePolicy struct {
	DeletedID  string    `json:"_id,omitempty"`
	ID         string    `json:"id,omitempty"`
	CreatedAt  time.Time `json:"createdAt"`
	UpdatedAt  time.Time `json:"updatedAt"`
	RuleID     string    `json:"ruleId"`
	IsPostPlan bool      `json:"isPostPlan"`
}

type PipelineRun

type PipelineRun struct {
	ID            string    `json:"id"`
	AccountID     string    `json:"-"`
	EnvironmentID string    `json:"environmentId"`
	UserID        string    `json:"userId"`
	Source        string    `json:"source"`
	CreatedAt     time.Time `json:"createdAt"`
	UpdatedAt     time.Time `json:"updatedAt"`
	Status        string    `json:"status"`
	Branch        string    `json:"branch"`
	Commit        string    `json:"commit"`
	Description   string    `json:"description"`
	HasChanges    bool      `json:"hasChanges"`
}

type PipelineVCS

type PipelineVCS struct {
	Branch string `json:"branch"`
	Path   string `json:"path"`
	Repo   string `json:"repo"`
	VCSID  string `json:"vcsId"`
}

type PipelineVariable

type PipelineVariable struct {
	DeletedID   string    `json:"_id,omitempty"`
	ID          string    `json:"id,omitempty"`
	AccountID   string    `json:"-"`
	PipelineID  string    `json:"environmentId"`
	CreatedAt   time.Time `json:"createdAt"`
	UpdatedAt   time.Time `json:"updatedAt"`
	Type        string    `json:"type"`
	Description string    `json:"description,omitempty"`
	Encrypted   bool      `json:"encrypted"`
	Key         string    `json:"key"`
	Value       string    `json:"value"`
}

type Resource

type Resource struct {
	Name          string `json:"name"`
	Provider      string `json:"provider"`
	ProviderID    string `json:"providerId"`
	AssetID       string `json:"assetId"`
	AssetType     string `json:"assetType"`
	Region        string `json:"region"`
	EnvironmentID string `json:"environmentId"`
	IacType       string `json:"iacType"`
}

type ResourceDetails

type ResourceDetails struct {
	ARN               string     `json:"arn,omitempty"`
	ID                string     `json:"id,omitempty"`
	Name              string     `json:"name,omitempty"`
	Type              string     `json:"type,omitempty"`
	ModuleAddress     string     `json:"module_address,omitempty"`
	Address           string     `json:"address,omitempty"`
	ProviderName      string     `json:"provider_name,omitempty"`
	EffectedResources []Resource `json:"effected_resources,omitempty"`
}

type Stack

type Stack struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

type State

type State struct {
	AccountID string          `json:"accountId"`
	ID        string          `json:"id"`
	StackID   string          `json:"stackId"`
	CreatedAt time.Time       `json:"createdAt,omitempty"`
	Policy    json.RawMessage `json:"policy"`
	RunID     string          `json:"runId,omitempty"`
}

type UpdateClassificationInput

type UpdateClassificationInput struct {
	Name        string   `json:"name"`
	Type        string   `json:"type"`
	Description string   `json:"description"`
	Rego        string   `json:"code"`
	Labels      []string `json:"labels"`
}

type UpdatePipelineInput

type UpdatePipelineInput struct {
	Name             string                `json:"name"`
	Owner            string                `json:"owner"`
	IsTerragrunt     bool                  `json:"isTerragrunt"`
	AutoApprove      bool                  `json:"autoApprove"`
	TerraformVersion string                `json:"terraformVersion"`
	VCS              PipelineVCS           `json:"vcs,omitempty"`
	FailurePolicy    PipelineFailurePolicy `json:"policy,omitempty"`
}

type UpdatePipelineVariableInput

type UpdatePipelineVariableInput struct {
	Key         string `json:"key"`
	Value       string `json:"value"`
	Description string `json:"description"`
}

type User

type User struct {
	ID   string `json:"user_id"`
	Name string `json:"name"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL