aws

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2023 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Overview

Package aws contains aws clients and session.

Package aws contains aws clients and session.

Package aws contains tests for aws clients and session.

Package aws contains tests for aws clients and session.

Package aws contains tests for aws clients and session.

Package aws contains tests for aws clients and session.

Package aws contains tests for aws clients and session.

Package aws contains tests for AWS clients and session.

Package aws contains tests for aws clients and session.

Package aws contains aws clients and session.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnsureCloudformationExists

func EnsureCloudformationExists(client CloudformationClient, stackName string, repoName string, repoDescription string, bucketName string, zipFileName string) (bool, error)

EnsureCloudformationExists creates a new cloudformation stack with the given name, or returns success if it already exists.

func EnsureCodeBuildProjectExists

func EnsureCodeBuildProjectExists(client CodeBuildClient, aftManagementAccountID string, codeBuildDockerImage string, projectName string, repoName string, repoBranch string, codeBuildRoleName string) (bool, error)

EnsureCodeBuildProjectExists creates a new codebuild project with the given name, or returns success if it already exists.

func EnsureCodeCommitRepoExists

func EnsureCodeCommitRepoExists(client CodeCommitClient, repoName string, description string) (bool, error)

EnsureCodeCommitRepoExists creates a new codecommit repository with the given name, or returns success if it already exists.

func EnsureCodePipelineExists

func EnsureCodePipelineExists(client CodePipelineClient, aftManagementAccountID string, codePipelineRoleName string, pipelineName string, codeSuiteBucketName string, repoName string, branchName string, codeBuildProjectName string) (bool, error)

EnsureCodePipelineExists creates a new codepipeline pipeline with the given name, or returns success if it already exists.

func EnsureIamRoleExists

func EnsureIamRoleExists(client IAMClient, roleName string, trustRelationShipService string, policyName string, region string, aftAccount string, repoName string, bucketName string, terraformStateBucketName string) (bool, error)

EnsureIamRoleExists creates a new IAM Role with the given name, or returns success if it already exists.

func EnsureS3BucketExists

func EnsureS3BucketExists(client S3Client, bucketName string, aftManagementAccountID string, kmsKeyID string, codeBuildRole string) (bool, error)

EnsureS3BucketExists creates a new S3 bucket with the given name, or returns success if it already exists.

func UploadToS3

func UploadToS3(client S3Client, bucketName string, bucketKey string, fileName string) error

UploadToS3 to upload the zip file to S3 Bucket

Types

type Client

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

Client struct implementing all the client interfaces

func NewClient

func NewClient() *Client

NewClient loads credentials following the chain credentials

func (*Client) GetCloudFormationClient

func (ac *Client) GetCloudFormationClient() cloudformationiface.CloudFormationAPI

GetCloudFormationClient returns the client for AWS CloudFormation service.

func (*Client) GetCodeBuildClient

func (ac *Client) GetCodeBuildClient() codebuildiface.CodeBuildAPI

GetCodeBuildClient returns the client for AWS CodeBuild service.

func (*Client) GetCodeCommitClient

func (ac *Client) GetCodeCommitClient() codecommitiface.CodeCommitAPI

GetCodeCommitClient fetches the CodeCommit Client and enables the cmd to use

func (*Client) GetCodePipelineClient

func (ac *Client) GetCodePipelineClient() codepipelineiface.CodePipelineAPI

GetCodePipelineClient fetches the Code Pipeline Client and enables the cmd to use

func (*Client) GetIamClient

func (ac *Client) GetIamClient() iamiface.IAMAPI

GetIamClient fetches the IAM Client and enables the cmd to use

func (*Client) GetS3Client

func (ac *Client) GetS3Client() s3iface.S3API

GetS3Client fetches the S3 Client and enables the cmd to use

type ClientMockCloudFormationClient

type ClientMockCloudFormationClient struct {
	cloudformationiface.CloudFormationAPI
}

ClientMockCloudFormationClient is a mock of CloudFormationAPI

type ClientMockCodeBuildClient

type ClientMockCodeBuildClient struct {
	codebuildiface.CodeBuildAPI
}

ClientMockCodeBuildClient is a mock of CodeBuildAPI

type ClientMockCodeCommitClient

type ClientMockCodeCommitClient struct {
	codecommitiface.CodeCommitAPI
}

ClientMockCodeCommitClient is a mock of CodeCommitAPI

type ClientMockCodePipelineClient

type ClientMockCodePipelineClient struct {
	codepipelineiface.CodePipelineAPI
}

ClientMockCodePipelineClient is a mock of CodePipelineAPI

type ClientMockIamClient

type ClientMockIamClient struct {
	iamiface.IAMAPI
}

ClientMockIamClient is a mock of IAMAPI

type ClientMockS3Client

type ClientMockS3Client struct {
	s3iface.S3API
}

ClientMockS3Client is a mock of S3API

type CloudformationClient

CloudformationClient represents a client for Cloudformation.

type CodeBuildClient

type CodeBuildClient interface {
	CreateProject(*codebuild.CreateProjectInput) (*codebuild.CreateProjectOutput, error)
	ListProjects(*codebuild.ListProjectsInput) (*codebuild.ListProjectsOutput, error)
}

CodeBuildClient represents a client for Amazon Code Build.

type CodeCommitClient

CodeCommitClient represents a client for Amazon Code Commit.

type CodePipelineClient

type CodePipelineClient interface {
	CreatePipeline(*codepipeline.CreatePipelineInput) (*codepipeline.CreatePipelineOutput, error)
	ListPipelines(input *codepipeline.ListPipelinesInput) (*codepipeline.ListPipelinesOutput, error)
}

CodePipelineClient represents a client for Amazon Code Pipeline.

type FileReader

type FileReader func(string) ([]byte, error)

FileReader is a function type that reads a file and returns its content as a byte slice.

var ReadFile FileReader = os.ReadFile

ReadFile is a variable of type FileReader, initially set to os.ReadFile.

type IAMClient

type IAMClient interface {
	CreateRole(*iam.CreateRoleInput) (*iam.CreateRoleOutput, error)
	PutRolePolicy(*iam.PutRolePolicyInput) (*iam.PutRolePolicyOutput, error)
	GetRole(*iam.GetRoleInput) (*iam.GetRoleOutput, error)
}

IAMClient represents a client for Amazon Code Commit.

type MockCloudformationClient

MockCloudformationClient is a mock implementation of an Cloudformation for testing.

func (*MockCloudformationClient) CreateStack

CreateStack is a mock implementation of the CreateStack method.

func (*MockCloudformationClient) DescribeStacks

DescribeStacks is a mock implementation of the DescribeStacks method.

type MockCodeBuildClient

type MockCodeBuildClient struct {
	codebuildiface.CodeBuildAPI

	CreateProjectFunc func(*codebuild.CreateProjectInput) (*codebuild.CreateProjectOutput, error)
	ListProjectsFunc  func(*codebuild.ListProjectsInput) (*codebuild.ListProjectsOutput, error)
}

MockCodeBuildClient is a mock implementation of an S3 client for testing.

func (*MockCodeBuildClient) CreateProject

CreateProject is a mock implementation of the CreateProject method.

func (*MockCodeBuildClient) ListProjects

ListProjects is a mock implementation of the ListProjects method.

type MockCodeCommitClient

type MockCodeCommitClient struct {
	codecommitiface.CodeCommitAPI

	CreateRepositoryFunc func(*codecommit.CreateRepositoryInput) (*codecommit.CreateRepositoryOutput, error)
	GetRepositoryFunc    func(*codecommit.GetRepositoryInput) (*codecommit.GetRepositoryOutput, error)
}

MockCodeCommitClient is a mock implementation of an S3 client for testing.

func (*MockCodeCommitClient) CreateRepository

CreateRepository is a mock implementation of the CreateRepository method.

func (*MockCodeCommitClient) GetRepository

GetRepository is a mock implementation of the GetRepository method.

type MockCodePipelineClient

type MockCodePipelineClient struct {
	codepipelineiface.CodePipelineAPI
	CreatePipelineFunc func(*codepipeline.CreatePipelineInput) (*codepipeline.CreatePipelineOutput, error)
	ListPipelinesFunc  func(*codepipeline.ListPipelinesInput) (*codepipeline.ListPipelinesOutput, error)
}

MockCodePipelineClient is a mock implementation of an S3 client for testing.

func (*MockCodePipelineClient) CreatePipeline

CreatePipeline is a mock implementation of the CreatePipeline method.

type MockIAMClient

type MockIAMClient struct {
	iamiface.IAMAPI
	CreateRoleFunc    func(input *iam.CreateRoleInput) (*iam.CreateRoleOutput, error)
	PutRolePolicyFunc func(input *iam.PutRolePolicyInput) (*iam.PutRolePolicyOutput, error)
	GetRoleFunc       func(input *iam.GetRoleInput) (*iam.GetRoleOutput, error)
}

MockIAMClient is a mock implementation of an IAM client for testing.

func (*MockIAMClient) CreateRole

func (m *MockIAMClient) CreateRole(input *iam.CreateRoleInput) (*iam.CreateRoleOutput, error)

CreateRole is a mock implementation of the CreateRole method.

func (*MockIAMClient) GetRole

func (m *MockIAMClient) GetRole(input *iam.GetRoleInput) (*iam.GetRoleOutput, error)

GetRole is a mock implementation of the GetRoleFunc method.

func (*MockIAMClient) PutRolePolicy

func (m *MockIAMClient) PutRolePolicy(input *iam.PutRolePolicyInput) (*iam.PutRolePolicyOutput, error)

PutRolePolicy is a mock implementation of the PutRolePolicy method.

type MockS3Client

type MockS3Client struct {
	s3iface.S3API
	ListBucketsFunc           func(input *s3.ListBucketsInput) (*s3.ListBucketsOutput, error)
	CreateBucketFunc          func(input *s3.CreateBucketInput) (*s3.CreateBucketOutput, error)
	WaitUntilBucketExistsFunc func(*s3.HeadBucketInput) error
	PutPublicAccessBlockFunc  func(input *s3.PutPublicAccessBlockInput) (*s3.PutPublicAccessBlockOutput, error)
	PutBucketPolicyFunc       func(*s3.PutBucketPolicyInput) (*s3.PutBucketPolicyOutput, error)
	PutBucketTaggingFunc      func(*s3.PutBucketTaggingInput) (*s3.PutBucketTaggingOutput, error)
	PutObjectFunc             func(*s3.PutObjectInput) (*s3.PutObjectOutput, error)
}

MockS3Client is a mock implementation of an S3 client for testing.

func (*MockS3Client) CreateBucket

func (m *MockS3Client) CreateBucket(input *s3.CreateBucketInput) (*s3.CreateBucketOutput, error)

CreateBucket is a mock implementation of the CreateBucket method.

func (*MockS3Client) ListBuckets

func (m *MockS3Client) ListBuckets(input *s3.ListBucketsInput) (*s3.ListBucketsOutput, error)

ListBuckets is a mock implementation of the ListBuckets method.

func (*MockS3Client) PutBucketPolicy

func (m *MockS3Client) PutBucketPolicy(input *s3.PutBucketPolicyInput) (*s3.PutBucketPolicyOutput, error)

PutBucketPolicy is a mock implementation of the PutBucketPolicy method.

func (*MockS3Client) PutBucketTagging

func (m *MockS3Client) PutBucketTagging(input *s3.PutBucketTaggingInput) (*s3.PutBucketTaggingOutput, error)

PutBucketTagging is a mock implementation of the PutBucketTagging method.

func (*MockS3Client) PutObject

func (m *MockS3Client) PutObject(input *s3.PutObjectInput) (*s3.PutObjectOutput, error)

PutObject is a mock implementation of the PutObject method.

func (*MockS3Client) PutPublicAccessBlock

func (m *MockS3Client) PutPublicAccessBlock(input *s3.PutPublicAccessBlockInput) (*s3.PutPublicAccessBlockOutput, error)

PutPublicAccessBlock is a mock implementation of the PutPublicAccessBlock method.

func (*MockS3Client) WaitUntilBucketExists

func (m *MockS3Client) WaitUntilBucketExists(input *s3.HeadBucketInput) error

WaitUntilBucketExists is a mock implementation of the WaitUntilBucketExists method.

type S3Client

type S3Client interface {
	ListBuckets(input *s3.ListBucketsInput) (*s3.ListBucketsOutput, error)
	CreateBucket(input *s3.CreateBucketInput) (*s3.CreateBucketOutput, error)
	WaitUntilBucketExists(*s3.HeadBucketInput) error
	PutPublicAccessBlock(*s3.PutPublicAccessBlockInput) (*s3.PutPublicAccessBlockOutput, error)
	PutBucketPolicy(*s3.PutBucketPolicyInput) (*s3.PutBucketPolicyOutput, error)
	PutBucketTagging(*s3.PutBucketTaggingInput) (*s3.PutBucketTaggingOutput, error)
	PutObject(*s3.PutObjectInput) (*s3.PutObjectOutput, error)
}

S3Client represents a client for Amazon S3.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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