amazon

package
v0.0.0-...-4eb3eab Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CostS3Policy = `` /* 487-byte string literal not displayed */

Functions

func NewAmazonConfig

func NewAmazonConfig(key, sec string) (*aws.Config, error)

NewAmazonConfig - returns an aws config struct with access key + secret + region set

Types

type Client

type Client struct {
	AccessKey     string
	SecretKey     string
	Credentials   *aws.Config
	Iam           *iam.Client
	S3            *s3.Client
	CostReporting *cost.Client
}

Client the amazon client object, holds credentials and API clients for each service necessary which are set when instantiated from the `NewClient` method.

func NewClient

func NewClient(key, sec string, apis ...string) (*Client, error)

NewClient - takes a key+secret and list of API clients to set up returns: new AmazonClient and error

func (*Client) AttachBucketPolicy

func (a *Client) AttachBucketPolicy(bucket, policy string) error

PutBucketPolicy - attaches a policy to a bucket returns error

func (*Client) BindPolicyToRole

func (a *Client) BindPolicyToRole(policy, role string) error

BindPolicyToRole - attaches policy (arn) to role (name) returns: error

func (*Client) CreateCostAndUsageReport

func (a *Client) CreateCostAndUsageReport(costReport *CostReport) error

CreateCostAndUsageReport - creates a cost report based on input returns an error if there was a problem

func (*Client) CreatePolicy

func (a *Client) CreatePolicy(name, payload string) (*string, error)

CreatePolicy - creates an IAM policy with given name + payload, the payload comes from the superkey metadata in the job payload returns: (ARN of new policy, error)

func (*Client) CreateRole

func (a *Client) CreateRole(name, payload string) (*string, error)

CreateRole - creates a role with name from a json payload returns: error

func (*Client) CreateS3Bucket

func (a *Client) CreateS3Bucket(name string) error

CreateS3Bucket - Creates an s3 bucket from name and config returns error if anything went wrong

func (*Client) DestroyCostAndUsageReport

func (a *Client) DestroyCostAndUsageReport(name string) error

DestroyCostAndUsageReport - creates a cost report based on input returns an error if there was a problem

func (*Client) DestroyPolicy

func (a *Client) DestroyPolicy(arn string) error

DestroyPolicy - inverse of CreatePolicy, takes an ARN pointing to a Policy and destroys it. returns: error

func (*Client) DestroyRole

func (a *Client) DestroyRole(name string) error

DestroyRole - destroys a role with name returns: error

func (*Client) DestroyS3Bucket

func (a *Client) DestroyS3Bucket(name string) error

DestroyS3Bucket - Destroys an s3 bucket from name and config returns error if anything went wrong

func (*Client) UnBindPolicyToRole

func (a *Client) UnBindPolicyToRole(policy, role string) error

UnBindPolicyToRole - detaches policy (arn) from role (name) returns: error

type CostReport

type CostReport struct {
	AdditionalArtifacts      []costtypes.AdditionalArtifact `json:"additional_artifacts"`
	AdditionalSchemaElements []costtypes.SchemaElement      `json:"additional_schema_elements"`
	Compression              costtypes.CompressionFormat    `json:"compression"`
	Format                   costtypes.ReportFormat         `json:"format"`
	TimeUnit                 costtypes.TimeUnit             `json:"time_unit"`
	ReportName               string                         `json:"report_name"`
	S3Prefix                 string                         `json:"s3_prefix"`
	S3Region                 costtypes.AWSRegion            `json:"s3_region"`
	S3Bucket                 string                         `json:"s3_bucket"`
}

Jump to

Keyboard shortcuts

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