sampolicies

package
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2020 License: MIT Imports: 3 Imported by: 6

Documentation

Overview

Package sampolicies allows you to choose from a list of AWS SAM policy templates to scope the permissions of your Lambda functions to the resources that are used by your application.

Index

Constants

View Source
const (
	// AccountIDMissingErr is returned when GetPolicyStatement is executed without an accountID
	AccountIDMissingErr = "factory is missing required variable accountID"

	// PartitionMissingErr is returned when GetPolicyStatement is executed without a partition
	PartitionMissingErr = "factory is missing required variable partition"

	// RegionMissingErr is returned when GetPolicyStatement is executed without a region
	RegionMissingErr = "factory is missing required variable region"
)

Variables

This section is empty.

Functions

func AssumeRoleLambda

func AssumeRoleLambda() string

AssumeRoleLambda returns an IAM policy document that allows the IAM role to be assumed by AWS Lambda

Types

type Factory

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

Factory is the main struct to create all new policies. It also has methods to get the IAM statement and add new policies to the array.

func NewFactory

func NewFactory() *Factory

NewFactory returns a new Factory pointer that can be chained with builder methods to set multiple configuration values inline without using pointers.

func (*Factory) AddAMIDescribePolicy

func (f *Factory) AddAMIDescribePolicy()

AddAMIDescribePolicy Gives permissions to describe AMIs

func (*Factory) AddAWSSecretsManagerGetSecretValuePolicy

func (f *Factory) AddAWSSecretsManagerGetSecretValuePolicy(secretArn string)

AddAWSSecretsManagerGetSecretValuePolicy Grants permissions to GetSecretValue for the specified AWS Secrets Manager secret

func (*Factory) AddAWSSecretsManagerRotationPolicy

func (f *Factory) AddAWSSecretsManagerRotationPolicy()

AddAWSSecretsManagerRotationPolicy Grants permissions to APIs required to rotate a secret in AWS Secrets Manager

func (*Factory) AddAssumeRoleLambda

func (f *Factory) AddAssumeRoleLambda()

AddAssumeRoleLambda allows AWS Lambda to assume the role and use AWS services

func (*Factory) AddAthenaQueryPolicy

func (f *Factory) AddAthenaQueryPolicy()

AddAthenaQueryPolicy Gives permissions to execute Athena queries

func (*Factory) AddCloudFormationDescribeStacksPolicy

func (f *Factory) AddCloudFormationDescribeStacksPolicy()

AddCloudFormationDescribeStacksPolicy Gives permission to describe CloudFormation stacks

func (*Factory) AddCloudWatchDashboardPolicy

func (f *Factory) AddCloudWatchDashboardPolicy()

AddCloudWatchDashboardPolicy Gives permissions to put metrics to operate on CloudWatch Dashboards

func (*Factory) AddCloudWatchDescribeAlarmHistoryPolicy

func (f *Factory) AddCloudWatchDescribeAlarmHistoryPolicy()

AddCloudWatchDescribeAlarmHistoryPolicy Gives permissions to describe CloudWatch alarm history

func (*Factory) AddCloudWatchPutMetricPolicy

func (f *Factory) AddCloudWatchPutMetricPolicy()

AddCloudWatchPutMetricPolicy Gives permissions to put metrics to CloudWatch

func (*Factory) AddCodeCommitCrudPolicy

func (f *Factory) AddCodeCommitCrudPolicy(repositoryName string)

AddCodeCommitCrudPolicy Gives permissions to create/read/update/delete objects within a specific codecommit repository

func (*Factory) AddCodeCommitReadPolicy

func (f *Factory) AddCodeCommitReadPolicy(repositoryName string)

AddCodeCommitReadPolicy Gives permissions to read objects within a specific codecommit repository

func (*Factory) AddCodePipelineLambdaExecutionPolicy

func (f *Factory) AddCodePipelineLambdaExecutionPolicy()

AddCodePipelineLambdaExecutionPolicy Gives permission for a Lambda function invoked by AWS CodePipeline to report back status of the job

func (*Factory) AddCodePipelineReadOnlyPolicy

func (f *Factory) AddCodePipelineReadOnlyPolicy(pipelinename string)

AddCodePipelineReadOnlyPolicy Gives read permissions to get details about a CodePipeline pipeline

func (*Factory) AddComprehendBasicAccessPolicy

func (f *Factory) AddComprehendBasicAccessPolicy()

AddComprehendBasicAccessPolicy Gives access to Amazon Comprehend APIs for detecting entities, key phrases, languages and sentiments

func (*Factory) AddCostExplorerReadOnlyPolicy

func (f *Factory) AddCostExplorerReadOnlyPolicy()

AddCostExplorerReadOnlyPolicy Gives access to the readonly Cost Explorer APIs for billing history

func (*Factory) AddDynamoDBBackupFullAccessPolicy

func (f *Factory) AddDynamoDBBackupFullAccessPolicy(tableName string)

AddDynamoDBBackupFullAccessPolicy Gives read/write permissions to DynamoDB on-demand backups for a table

func (*Factory) AddDynamoDBCrudPolicy

func (f *Factory) AddDynamoDBCrudPolicy(tableName string)

AddDynamoDBCrudPolicy Gives CRUD access to a DynamoDB Table

func (*Factory) AddDynamoDBReadPolicy

func (f *Factory) AddDynamoDBReadPolicy(tableName string)

AddDynamoDBReadPolicy Gives read only access to a DynamoDB Table

func (*Factory) AddDynamoDBReconfigurePolicy

func (f *Factory) AddDynamoDBReconfigurePolicy(tableName string)

AddDynamoDBReconfigurePolicy Gives access reconfigure to a DynamoDB Table

func (*Factory) AddDynamoDBRestoreFromBackupPolicy

func (f *Factory) AddDynamoDBRestoreFromBackupPolicy(tableName string)

AddDynamoDBRestoreFromBackupPolicy Gives permissions to restore a table from backup

func (*Factory) AddDynamoDBStreamReadPolicy

func (f *Factory) AddDynamoDBStreamReadPolicy()

AddDynamoDBStreamReadPolicy Gives permission to describe and read a DynamoDB Stream and Records

func (*Factory) AddDynamoDBWritePolicy

func (f *Factory) AddDynamoDBWritePolicy(tableName string)

AddDynamoDBWritePolicy Gives write only access to a DynamoDB Table

func (*Factory) AddEC2CopyImagePolicy

func (f *Factory) AddEC2CopyImagePolicy(imageId string)

AddEC2CopyImagePolicy Gives permission top copy EC2 Images

func (*Factory) AddEC2DescribePolicy

func (f *Factory) AddEC2DescribePolicy()

AddEC2DescribePolicy Gives permission to describe EC2 instances

func (*Factory) AddEKSDescribePolicy

func (f *Factory) AddEKSDescribePolicy()

AddEKSDescribePolicy Gives permission to describe or list Amazon EKS clusters

func (*Factory) AddElasticsearchHttpPostPolicy

func (f *Factory) AddElasticsearchHttpPostPolicy(domainName string)

AddElasticsearchHttpPostPolicy Gives POST and PUT permissions to Elasticsearch

func (*Factory) AddEventBridgePutEventsPolicy

func (f *Factory) AddEventBridgePutEventsPolicy(eventBusName string)

AddEventBridgePutEventsPolicy Gives permissions to send events to EventBridge

func (*Factory) AddExecuteAPI

func (f *Factory) AddExecuteAPI()

AddExecuteAPI allows the IAM role to execute API invocations

func (*Factory) AddFilterLogEventsPolicy

func (f *Factory) AddFilterLogEventsPolicy(logGroupName string)

AddFilterLogEventsPolicy Gives permission to filter Log Events from a specified Log Group

func (*Factory) AddFirehoseCrudPolicy

func (f *Factory) AddFirehoseCrudPolicy(deliveryStreamName string)

AddFirehoseCrudPolicy Gives permission to create, write to, update, and delete a Kinesis Firehose Delivery Stream

func (*Factory) AddFirehoseWritePolicy

func (f *Factory) AddFirehoseWritePolicy(deliveryStreamName string)

AddFirehoseWritePolicy Gives permission to write to a Kinesis Firehose Delivery Stream

func (*Factory) AddKMSDecryptPolicy

func (f *Factory) AddKMSDecryptPolicy(keyId string)

AddKMSDecryptPolicy Gives permission to decrypt with KMS Key

func (*Factory) AddKMSEncryptPolicy

func (f *Factory) AddKMSEncryptPolicy(keyId string)

AddKMSEncryptPolicy Gives permission to encrypt with KMS Key

func (*Factory) AddKinesisCrudPolicy

func (f *Factory) AddKinesisCrudPolicy(streamName string)

AddKinesisCrudPolicy Gives permission to create, publish and delete Kinesis Stream

func (*Factory) AddKinesisStreamReadPolicy

func (f *Factory) AddKinesisStreamReadPolicy()

AddKinesisStreamReadPolicy Gives permission to list and read a Kinesis stream

func (*Factory) AddLambdaInvokePolicy

func (f *Factory) AddLambdaInvokePolicy(functionName string)

AddLambdaInvokePolicy Gives permission to invoke a Lambda Function, Alias or Version

func (*Factory) AddMobileAnalyticsWriteOnlyAccessPolicy

func (f *Factory) AddMobileAnalyticsWriteOnlyAccessPolicy()

AddMobileAnalyticsWriteOnlyAccessPolicy Gives write only permissions to put event data for all application resources

func (*Factory) AddOrganizationsListAccountsPolicy

func (f *Factory) AddOrganizationsListAccountsPolicy()

AddOrganizationsListAccountsPolicy Gives readonly permission to list child account names and ids

func (*Factory) AddPinpointEndpointAccessPolicy

func (f *Factory) AddPinpointEndpointAccessPolicy(pinpointApplicationId string)

AddPinpointEndpointAccessPolicy Gives permissions to get and update endpoints for a Pinpoint application

func (*Factory) AddPollyFullAccessPolicy

func (f *Factory) AddPollyFullAccessPolicy(lexiconName string)

AddPollyFullAccessPolicy Gives full access permissions to Polly lexicon resources

func (*Factory) AddRekognitionDetectOnlyPolicy

func (f *Factory) AddRekognitionDetectOnlyPolicy()

AddRekognitionDetectOnlyPolicy Gives permission to detect faces, labels and text

func (*Factory) AddRekognitionFacesManagementPolicy

func (f *Factory) AddRekognitionFacesManagementPolicy(collectionId string)

AddRekognitionFacesManagementPolicy Gives permission to add, delete and search faces in a collection

func (*Factory) AddRekognitionFacesPolicy

func (f *Factory) AddRekognitionFacesPolicy()

AddRekognitionFacesPolicy Gives permission to compare and detect faces and labels

func (*Factory) AddRekognitionLabelsPolicy

func (f *Factory) AddRekognitionLabelsPolicy()

AddRekognitionLabelsPolicy Gives permission to detect object and moderation labels

func (*Factory) AddRekognitionNoDataAccessPolicy

func (f *Factory) AddRekognitionNoDataAccessPolicy(collectionId string)

AddRekognitionNoDataAccessPolicy Gives permission to compare and detect faces and labels

func (*Factory) AddRekognitionReadPolicy

func (f *Factory) AddRekognitionReadPolicy(collectionId string)

AddRekognitionReadPolicy Gives permission to list and search faces

func (*Factory) AddRekognitionWriteOnlyAccessPolicy

func (f *Factory) AddRekognitionWriteOnlyAccessPolicy(collectionId string)

AddRekognitionWriteOnlyAccessPolicy Gives permission to create collection and index faces

func (*Factory) AddS3CrudPolicy

func (f *Factory) AddS3CrudPolicy(bucketName string)

AddS3CrudPolicy Gives CRUD permissions to objects in the S3 Bucket

func (*Factory) AddS3FullAccessPolicy

func (f *Factory) AddS3FullAccessPolicy(bucketName string)

AddS3FullAccessPolicy Gives full access permissions to objects in the S3 Bucket

func (*Factory) AddS3ReadPolicy

func (f *Factory) AddS3ReadPolicy(bucketName string)

AddS3ReadPolicy Gives read permissions to objects in the S3 Bucket

func (*Factory) AddS3WritePolicy

func (f *Factory) AddS3WritePolicy(bucketName string)

AddS3WritePolicy Gives write permissions to objects in the S3 Bucket

func (*Factory) AddSESBulkTemplatedCrudPolicy

func (f *Factory) AddSESBulkTemplatedCrudPolicy(identityName string)

AddSESBulkTemplatedCrudPolicy Gives permission to send email, templated email, templated bulk emails and verify identity

func (*Factory) AddSESCrudPolicy

func (f *Factory) AddSESCrudPolicy(identityName string)

AddSESCrudPolicy Gives permission to send email and verify identity

func (*Factory) AddSESEmailTemplateCrudPolicy

func (f *Factory) AddSESEmailTemplateCrudPolicy()

AddSESEmailTemplateCrudPolicy Gives permission to create, get, list, update and delete SES Email Templates

func (*Factory) AddSESSendBouncePolicy

func (f *Factory) AddSESSendBouncePolicy(identityName string)

AddSESSendBouncePolicy Gives SendBounce permission to a SES identity

func (*Factory) AddSNSCrudPolicy

func (f *Factory) AddSNSCrudPolicy(topicName string)

AddSNSCrudPolicy Gives permissions to create, publish and subscribe to SNS topics

func (*Factory) AddSNSPublishMessagePolicy

func (f *Factory) AddSNSPublishMessagePolicy(topicName string)

AddSNSPublishMessagePolicy Gives permission to publish message to SNS Topic

func (*Factory) AddSQSPollerPolicy

func (f *Factory) AddSQSPollerPolicy(queueName string)

AddSQSPollerPolicy Gives permissions to poll an SQS Queue

func (*Factory) AddSQSSendMessagePolicy

func (f *Factory) AddSQSSendMessagePolicy(queueName string)

AddSQSSendMessagePolicy Gives permission to send message to SQS Queue

func (*Factory) AddSSMParameterReadPolicy

func (f *Factory) AddSSMParameterReadPolicy()

AddSSMParameterReadPolicy Gives access to a parameter to load secrets in this account. If not using default key, KMSDecryptPolicy will also be needed.

func (*Factory) AddServerlessRepoReadWriteAccessPolicy

func (f *Factory) AddServerlessRepoReadWriteAccessPolicy()

AddServerlessRepoReadWriteAccessPolicy Gives access permissions to create and list applications in the AWS Serverless Application Repository service

func (*Factory) AddStepFunctionsExecutionPolicy

func (f *Factory) AddStepFunctionsExecutionPolicy(stateMachineName string)

AddStepFunctionsExecutionPolicy Gives permission to start a Step Functions state machine execution

func (*Factory) AddTextractDetectAnalyzePolicy

func (f *Factory) AddTextractDetectAnalyzePolicy()

AddTextractDetectAnalyzePolicy Gives access to detect and analyze documents with Textract

func (*Factory) AddTextractGetResultPolicy

func (f *Factory) AddTextractGetResultPolicy()

AddTextractGetResultPolicy Gives access to get detected and analyzed documents from Textract

func (*Factory) AddTextractPolicy

func (f *Factory) AddTextractPolicy()

AddTextractPolicy Gives full access to Textract

func (*Factory) AddVPCAccessPolicy

func (f *Factory) AddVPCAccessPolicy()

AddVPCAccessPolicy Gives access to create, delete, describe and detach ENIs

func (*Factory) ClearPolicies

func (f *Factory) ClearPolicies()

ClearPolicies removes all policies so you can begin with a clean slate

func (*Factory) GetPolicyStatement

func (f *Factory) GetPolicyStatement() (string, error)

GetPolicyStatement creates the AWS IAM policy statement by linking together the policies that have been added so far and substituting the partition, region, and accountID. If any of the fields are missing, an error will be thrown.

func (*Factory) WithAccountID

func (f *Factory) WithAccountID(accountID string) *Factory

WithAccountID sets the AWS AccountID to use and returns a pointer to the existing resource to allow chaining.

func (*Factory) WithPartition

func (f *Factory) WithPartition(partition string) *Factory

WithPartition sets the AWS partition to use and returns a pointer to the existing resource to allow chaining.

func (*Factory) WithRegion

func (f *Factory) WithRegion(region string) *Factory

WithRegion sets the AWS region to use and returns a pointer to the existing resource to allow chaining.

Jump to

Keyboard shortcuts

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