client

package
v0.0.0-...-0b52e59 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2024 License: MPL-2.0 Imports: 119 Imported by: 0

Documentation

Overview

Code generated by codegen; DO NOT EDIT.

Index

Constants

View Source
const (
	PartitionServiceRegionFile = "data/partition_service_region.json"
)

Variables

View Source
var AllNamespaces = []string{
	"comprehend", "rds", "sagemaker", "appstream", "elasticmapreduce", "dynamodb", "lambda", "ecs", "cassandra", "ec2", "neptune", "kafka", "custom-resource", "elasticache",
}

Functions

func AccountMultiplex

func AccountMultiplex(meta schema.ClientMeta) []schema.ClientMeta

func AwsMockTestHelper

func AwsMockTestHelper(t *testing.T, table *schema.Table, builder func(*testing.T, *gomock.Controller) Services, _ TestOptions)

func Configure

func Configure(ctx context.Context, logger zerolog.Logger, spec specs.Source, baseAwsConfig aws.Config) (schema.ClientMeta, error)

func IgnoreAccessDeniedServiceDisabled

func IgnoreAccessDeniedServiceDisabled(err error) bool

func IgnoreCommonErrors

func IgnoreCommonErrors(err error) bool

func IgnoreNotAvailableRegion

func IgnoreNotAvailableRegion(err error) bool

func IgnoreWithInvalidAction

func IgnoreWithInvalidAction(err error) bool

func IsAWSError

func IsAWSError(err error, code ...string) bool

func IsInvalidParameterValueError

func IsInvalidParameterValueError(err error) bool

func RegionsPartition

func RegionsPartition(region string) (string, bool)

func ResolveARN

func ResolveARN(service AWSService, resourceID func(resource *schema.Resource) ([]string, error)) schema.ColumnResolver

ResolveARN returns a column resolver that will set a field value to a proper ARN based on provided AWS service and resource id value returned by resourceID function. Region and account id are set to the values of the client.

func ResolveARNGlobal

func ResolveARNGlobal(service AWSService, resourceID func(resource *schema.Resource) ([]string, error)) schema.ColumnResolver

ResolveARNGlobal returns a column resolver that will set a field value to a proper ARN based on provided AWS service and resource id value returned by resourceID function. Region and account id are left empty.

func ResolveARNWithAccount

func ResolveARNWithAccount(service AWSService, resourceID func(resource *schema.Resource) ([]string, error)) schema.ColumnResolver

ResolveARNWithAccount returns a column resolver that will set a field value to a proper ARN based on provided AWS service and resource id value returned by resourceID function. Region is left empty and account id is set to the value of the client.

func ResolveARNWithRegion

func ResolveARNWithRegion(service AWSService, resourceID func(resource *schema.Resource) ([]string, error)) schema.ColumnResolver

ResolveARNWithRegion returns a column resolver that will set a field value to a proper ARN based on provided AWS service and resource id value returned by resourceID function. Region is set to the value of the client and account id is left empty.

func ResolveAWSAccount

func ResolveAWSAccount(_ context.Context, meta schema.ClientMeta, r *schema.Resource, _ schema.Column) error

func ResolveAWSNamespace

func ResolveAWSNamespace(_ context.Context, meta schema.ClientMeta, r *schema.Resource, _ schema.Column) error

func ResolveAWSRegion

func ResolveAWSRegion(_ context.Context, meta schema.ClientMeta, r *schema.Resource, _ schema.Column) error

func ResolveTagField

func ResolveTagField(fieldName string) func(context.Context, schema.ClientMeta, *schema.Resource, schema.Column) error

func ResolveTags

func ResolveTags(ctx context.Context, meta schema.ClientMeta, r *schema.Resource, c schema.Column) error

func ResolveWAFScope

func ResolveWAFScope(_ context.Context, meta schema.ClientMeta, r *schema.Resource, c schema.Column) error

func ServiceAccountRegionMultiplexer

func ServiceAccountRegionMultiplexer(service string) func(meta schema.ClientMeta) []schema.ClientMeta

func ServiceAccountRegionNamespaceMultiplexer

func ServiceAccountRegionNamespaceMultiplexer(service string) func(meta schema.ClientMeta) []schema.ClientMeta

func ServiceAccountRegionScopeMultiplexer

func ServiceAccountRegionScopeMultiplexer(service string) func(meta schema.ClientMeta) []schema.ClientMeta

func Sleep

func Sleep(ctx context.Context, dur time.Duration) error

func StaticValueResolver

func StaticValueResolver(value any) schema.ColumnResolver

func TagsIntoMap

func TagsIntoMap(tagSlice any, dst map[string]string)

TagsIntoMap expects []T (usually "[]Tag") where T has "Key" and "Value" fields (of type string or *string) and writes them into the given map

func TagsToMap

func TagsToMap(tagSlice any) map[string]string

TagsToMap expects []T (usually "[]Tag") where T has "Key" and "Value" fields (of type string or *string) and returns a map

Types

type AWSService

type AWSService string
const (
	ApigatewayService           AWSService = "apigateway"
	Athena                      AWSService = "athena"
	CloudformationService       AWSService = "cloudformation"
	CloudfrontService           AWSService = "cloudfront"
	CognitoIdentityService      AWSService = "cognito-identity"
	DirectConnectService        AWSService = "directconnect"
	DynamoDBService             AWSService = "dynamodb"
	EC2Service                  AWSService = "ec2"
	EFSService                  AWSService = "elasticfilesystem"
	ElasticLoadBalancingService AWSService = "elasticloadbalancing"
	GlueService                 AWSService = "glue"
	GuardDutyService            AWSService = "guardduty"
	IamService                  AWSService = "iam"
	RedshiftService             AWSService = "redshift"
	Route53Service              AWSService = "route53"
	S3Service                   AWSService = "s3"
	SESService                  AWSService = "ses"
	WAFRegional                 AWSService = "waf-regional"
	WorkspacesService           AWSService = "workspaces"
)

type Account

type Account struct {
	ID            string   `json:"id"`
	AccountName   string   `json:"account_name,omitempty"`
	DefaultRegion string   `json:"default_region,omitempty"`
	Regions       []string `json:"regions,omitempty"`
}

type AssumeRoleAPIClient

type AssumeRoleAPIClient interface {
	AssumeRole(ctx context.Context, params *sts.AssumeRoleInput, optFns ...func(*sts.Options)) (*sts.AssumeRoleOutput, error)
}

type AwsLogger

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

func (AwsLogger) Logf

func (a AwsLogger) Logf(classification logging.Classification, format string, v ...any)

type AwsPartition

type AwsPartition struct {
	Id       string                 `json:"partition"`
	Name     string                 `json:"partitionName"`
	Services map[string]*AwsService `json:"services"`
}

type AwsService

type AwsService struct {
	Regions map[string]*map[string]any `json:"regions"`
}

type Client

type Client struct {
	// Those are already normalized values after configure and this is why we don't want to hold
	// config directly.
	ServicesManager ServicesManager

	// this is set by table clientList
	AccountID            string
	Region               string
	AutoscalingNamespace string
	WAFScope             wafv2types.Scope
	Partition            string
	// contains filtered or unexported fields
}

func NewAwsClient

func NewAwsClient(logger zerolog.Logger) Client

func (*Client) ID

func (c *Client) ID() string

func (*Client) IsAccessDeniedError

func (c *Client) IsAccessDeniedError(err error) bool

IsAccessDeniedError checks if api error should be classified as a permissions issue

func (*Client) IsNotFoundError

func (c *Client) IsNotFoundError(err error) bool

IsNotFoundError checks if api error should be ignored

func (*Client) Logger

func (c *Client) Logger() *zerolog.Logger

func (*Client) Services

func (c *Client) Services() *Services

type DetailResolverFunc

type DetailResolverFunc func(ctx context.Context, meta schema.ClientMeta, resultsChan chan<- any, errorChan chan<- error, summary any)

DetailResolveFunc is responsible for grabbing any and all metadata for a resource. All errors should be sent to the error channel.

type ListResolverFunc

type ListResolverFunc func(ctx context.Context, meta schema.ClientMeta, detailChan chan<- any) error

ListResolver is responsible for iterating through entire list of resources that should be grabbed (if API is paginated). It should send list of items via the `resultsChan` so that the DetailResolver can grab the details of each item. All errors should be sent to the error channel.

type NoRateLimiter

type NoRateLimiter struct {
}

func (*NoRateLimiter) AddTokens

func (*NoRateLimiter) AddTokens(uint) error

func (*NoRateLimiter) GetToken

func (*NoRateLimiter) GetToken(ctx context.Context, cost uint) (func() error, error)

type Services

type Services struct {
	Accessanalyzer            services.AccessanalyzerClient
	Account                   services.AccountClient
	Acm                       services.AcmClient
	Apigateway                services.ApigatewayClient
	Apigatewayv2              services.Apigatewayv2Client
	Applicationautoscaling    services.ApplicationautoscalingClient
	Apprunner                 services.ApprunnerClient
	Appstream                 services.AppstreamClient
	Appsync                   services.AppsyncClient
	Athena                    services.AthenaClient
	Autoscaling               services.AutoscalingClient
	Backup                    services.BackupClient
	Cloudformation            services.CloudformationClient
	Cloudfront                services.CloudfrontClient
	Cloudhsmv2                services.Cloudhsmv2Client
	Cloudtrail                services.CloudtrailClient
	Cloudwatch                services.CloudwatchClient
	Cloudwatchlogs            services.CloudwatchlogsClient
	Codebuild                 services.CodebuildClient
	Codepipeline              services.CodepipelineClient
	Cognitoidentity           services.CognitoidentityClient
	Cognitoidentityprovider   services.CognitoidentityproviderClient
	Configservice             services.ConfigserviceClient
	Databasemigrationservice  services.DatabasemigrationserviceClient
	Dax                       services.DaxClient
	Directconnect             services.DirectconnectClient
	Docdb                     services.DocdbClient
	Dynamodb                  services.DynamodbClient
	Ec2                       services.Ec2Client
	Ecr                       services.EcrClient
	Ecrpublic                 services.EcrpublicClient
	Ecs                       services.EcsClient
	Efs                       services.EfsClient
	Eks                       services.EksClient
	Elasticache               services.ElasticacheClient
	Elasticbeanstalk          services.ElasticbeanstalkClient
	Elasticloadbalancing      services.ElasticloadbalancingClient
	Elasticloadbalancingv2    services.Elasticloadbalancingv2Client
	Elasticsearchservice      services.ElasticsearchserviceClient
	Emr                       services.EmrClient
	Eventbridge               services.EventbridgeClient
	Firehose                  services.FirehoseClient
	Frauddetector             services.FrauddetectorClient
	Fsx                       services.FsxClient
	Glacier                   services.GlacierClient
	Glue                      services.GlueClient
	Guardduty                 services.GuarddutyClient
	Iam                       services.IamClient
	Identitystore             services.IdentitystoreClient
	Inspector                 services.InspectorClient
	Inspector2                services.Inspector2Client
	Iot                       services.IotClient
	Kafka                     services.KafkaClient
	Kinesis                   services.KinesisClient
	Kms                       services.KmsClient
	Lambda                    services.LambdaClient
	Lightsail                 services.LightsailClient
	Mq                        services.MqClient
	Mwaa                      services.MwaaClient
	Neptune                   services.NeptuneClient
	Organizations             services.OrganizationsClient
	Qldb                      services.QldbClient
	Quicksight                services.QuicksightClient
	Ram                       services.RamClient
	Rds                       services.RdsClient
	Redshift                  services.RedshiftClient
	Resourcegroups            services.ResourcegroupsClient
	Route53                   services.Route53Client
	Route53domains            services.Route53domainsClient
	S3                        services.S3Client
	S3control                 services.S3controlClient
	Sagemaker                 services.SagemakerClient
	Scheduler                 services.SchedulerClient
	Secretsmanager            services.SecretsmanagerClient
	Servicecatalog            services.ServicecatalogClient
	Servicecatalogappregistry services.ServicecatalogappregistryClient
	Servicequotas             services.ServicequotasClient
	Sesv2                     services.Sesv2Client
	Sfn                       services.SfnClient
	Shield                    services.ShieldClient
	Sns                       services.SnsClient
	Sqs                       services.SqsClient
	Ssm                       services.SsmClient
	Ssoadmin                  services.SsoadminClient
	Timestreamwrite           services.TimestreamwriteClient
	Transfer                  services.TransferClient
	Waf                       services.WafClient
	Wafregional               services.WafregionalClient
	Wafv2                     services.Wafv2Client
	Workspaces                services.WorkspacesClient
	Xray                      services.XrayClient
	S3manager                 services.S3managerClient
}

type ServicesManager

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

ServicesManager will hold the entire map of (account X region) services

func (*ServicesManager) InitServicesForPartitionAccountAndRegion

func (s *ServicesManager) InitServicesForPartitionAccountAndRegion(partition, accountId, region string, svcs Services)

func (*ServicesManager) InitServicesForPartitionAccountAndScope

func (s *ServicesManager) InitServicesForPartitionAccountAndScope(partition, accountId string, svcs Services)

func (*ServicesManager) ServicesByAccountForWAFScope

func (s *ServicesManager) ServicesByAccountForWAFScope(partition, accountId string) *Services

func (*ServicesManager) ServicesByPartitionAccountAndRegion

func (s *ServicesManager) ServicesByPartitionAccountAndRegion(partition, accountId, region string) *Services

type ServicesPartitionAccountRegionMap

type ServicesPartitionAccountRegionMap map[string]map[string]map[string]*Services

func (ServicesPartitionAccountRegionMap) Accounts

type Spec

type Spec struct {
	Regions    []string  `json:"regions,omitempty"`
	Accounts   []Account `json:"accounts"`
	AWSDebug   bool      `json:"aws_debug,omitempty"`
	MaxRetries *int      `json:"max_retries,omitempty"`
	MaxBackoff *int      `json:"max_backoff,omitempty"`
}

type SupportedServiceRegionsData

type SupportedServiceRegionsData struct {
	Partitions map[string]AwsPartition `json:"partitions"`
	// contains filtered or unexported fields
}

func ReadSupportedServiceRegions

func ReadSupportedServiceRegions() *SupportedServiceRegionsData

type TestOptions

type TestOptions struct{}

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
models
Code generated by codegen; DO NOT EDIT.
Code generated by codegen; DO NOT EDIT.

Jump to

Keyboard shortcuts

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