From 5381316a901e6efe91450466b85c5585c33cd32b Mon Sep 17 00:00:00 2001 From: talset Date: Tue, 14 Jul 2020 16:15:16 +0200 Subject: [PATCH 1/3] CHANGELOG: Add new entry for aws resources --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 26201aefc3..7401747ac9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ ## [Unreleased] +### Added + +- aws resource: `aws_alb_listener_certificate`, `aws_lb_cookie_stickiness_policy`, `aws_lb_target_group_attachment`, `aws_volume_attachment`, `aws_elasticsearch_domain`, `aws_elasticsearch_domain_policy`, `aws_lambda_function`, `aws_api_gateway_rest_api`, `aws_api_gateway_deployment`, `aws_api_gateway_stage`, `aws_api_gateway_resource`. + ([PR #128](https://github.com/cycloidio/terracognita/pull/128)) + ## [0.5.1] _2020-07-17_ ### Fixed From 0a46a572840ec661921b96c86eeafe151c714b8e Mon Sep 17 00:00:00 2001 From: talset Date: Tue, 14 Jul 2020 16:15:37 +0200 Subject: [PATCH 2/3] aws/resources: aws_alb_listener_certificate aws_lb_cookie_stickiness_policy Define resources * aws_alb_listener_certificate * aws_lb_cookie_stickiness_policy * aws_alb_target_group_attachment * aws_lb_target_group_attachment * aws_elasticsearch_domain_policy All are not importable by terraform yet. and * aws_volume_attachment * aws_elasticsearch_domain * aws_api_gateway_rest_api * aws_api_gateway_deployment * aws_api_gateway_stage * aws_api_gateway_resource --- aws/cache.go | 38 +++ aws/cmd/functions.go | 152 ++++++++++ aws/reader/connector.go | 40 +-- aws/resources.go | 603 ++++++++++++++++++++++++++++++++++------ 4 files changed, 734 insertions(+), 99 deletions(-) diff --git a/aws/cache.go b/aws/cache.go index 89de40720d..30fbf060db 100644 --- a/aws/cache.go +++ b/aws/cache.go @@ -9,6 +9,44 @@ import ( "github.com/pkg/errors" ) +func cacheAPIGatewayRestApis(ctx context.Context, a *aws, rt string, filters *filter.Filter) ([]provider.Resource, error) { + + rs, err := a.cache.Get(rt) + if err != nil { + if errors.Cause(err) != errcode.ErrCacheKeyNotFound { + return nil, errors.WithStack(err) + } + + rs, err = apiGatewayRestApis(ctx, a, rt, filters) + if err != nil { + return nil, err + } + + err = a.cache.Set(rt, rs) + if err != nil { + return nil, err + } + } + + return rs, nil +} + +func getAPIGatewayRestApis(ctx context.Context, a *aws, rt string, filters *filter.Filter) ([]string, error) { + rs, err := cacheAPIGatewayRestApis(ctx, a, rt, filters) + if err != nil { + return nil, err + } + + // Get the actual needed value + // TODO cach this result too + ids := make([]string, 0, len(rs)) + for _, i := range rs { + ids = append(ids, i.ID()) + } + + return ids, nil +} + func cacheLoadBalancersV2(ctx context.Context, a *aws, rt string, filters *filter.Filter) ([]provider.Resource, error) { // if both aws_alb and aws_lb defined, keep only aws_alb if filters.IsIncluded("aws_alb", "aws_lb") && (!filters.IsExcluded("aws_alb") && rt == "aws_lb") { diff --git a/aws/cmd/functions.go b/aws/cmd/functions.go index 55388083c8..980663e506 100644 --- a/aws/cmd/functions.go +++ b/aws/cmd/functions.go @@ -4,6 +4,63 @@ var ( // functions is the list of fuctions that will be added // to the AWSReader with the corresponding implementation functions = []Function{ + // apigateway + Function{ + FnName: "GetAPIGatewayDeployments", + Entity: "Deployments", + FnAttributeList: "Items", + SingularEntity: "Deployment", + Prefix: "Get", + Service: "apigateway", + FnPaginationAttribute: "Position", + FnInputPaginationAttribute: "Position", + Documentation: ` + // GetAPIGatewayDeployments returns the Deployment Functions on the given input + // Returned values are commented in the interface doc comment block. + `, + }, + Function{ + FnName: "GetAPIGatewayRestAPIs", + Entity: "RestApis", + FnAttributeList: "Items", + SingularEntity: "RestApi", + Prefix: "Get", + Service: "apigateway", + FnPaginationAttribute: "Position", + FnInputPaginationAttribute: "Position", + Documentation: ` + // GetAPIGatewayRestAPIs returns the RestApi Functions on the given input + // Returned values are commented in the interface doc comment block. + `, + }, + Function{ + FnName: "GetAPIGatewayStages", + Entity: "Stages", + FnAttributeList: "Item", + SingularEntity: "Stage", + Prefix: "Get", + Service: "apigateway", + HasNotPagination: true, + Documentation: ` + // GetAPIGatewayStages returns the Stage Functions on the given input + // Returned values are commented in the interface doc comment block. + `, + }, + Function{ + FnName: "GetAPIGatewayResources", + Entity: "Resources", + FnAttributeList: "Items", + SingularEntity: "Resource", + Prefix: "Get", + Service: "apigateway", + FnPaginationAttribute: "Position", + FnInputPaginationAttribute: "Position", + Documentation: ` + // GetAPIGatewayResources returns the Resource Functions on the given input + // Returned values are commented in the interface doc comment block. + `, + }, + // cloudwatch Function{ Entity: "MetricAlarms", @@ -192,6 +249,34 @@ var ( `, }, + // elasticsearch + Function{ + HasNotPagination: true, + Entity: "ElasticsearchDomains", + SingularEntity: "ElasticsearchDomainStatus", + FnAttributeList: "DomainStatusList", + Prefix: "Describe", + Service: "elasticsearchservice", + Documentation: ` + // GetElasticsearchDomains returns a list of domains of Elasticsearch resources. + // Returned values are commented in the interface doc comment block. + `, + }, + + Function{ + HasNotPagination: true, + FnName: "GetElasticsearchDomainNames", + Entity: "DomainNames", + SingularEntity: "DomainInfo", + FnAttributeList: "DomainNames", + Prefix: "List", + Service: "elasticsearchservice", + Documentation: ` + // GetElasticsearchDomainNames returns a list of domainNames of Elasticsearch resources. + // Returned values are commented in the interface doc comment block. + `, + }, + // elb Function{ Entity: "LoadBalancers", @@ -219,6 +304,30 @@ var ( // Returned values are commented in the interface doc comment block. `, }, + Function{ + Entity: "LoadBalancerAttributes", + SingularEntity: "AdditionalAttribute", + FnAttributeList: "LoadBalancerAttributes.AdditionalAttributes", + Prefix: "Describe", + HasNotPagination: true, + Service: "elb", + Documentation: ` + // GetLoadBalancerAttributes returns a list of Attributes based on the input from the different regions. + // Returned values are commented in the interface doc comment block. + `, + }, + Function{ + Entity: "LoadBalancerPolicies", + SingularEntity: "PolicyDescription", + FnAttributeList: "PolicyDescriptions", + Prefix: "Describe", + HasNotPagination: true, + Service: "elb", + Documentation: ` + // GetLoadBalancerPolicies returns a list of Policies based on the input from the different regions. + // Returned values are commented in the interface doc comment block. + `, + }, // elbv2 Function{ @@ -270,6 +379,19 @@ var ( // Returned values are commented in the interface doc comment block. `, }, + Function{ + FnName: "GetLoadBalancersV2TargetHealth", + Entity: "TargetHealth", + SingularEntity: "TargetHealthDescription", + FnAttributeList: "TargetHealthDescriptions", + Prefix: "Describe", + Service: "elbv2", + HasNotPagination: true, + Documentation: ` + // GetLoadBalancersV2TargetHealth returns a list of TargetHealth based on the input from the different regions. + // Returned values are commented in the interface doc comment block. + `, + }, Function{ Entity: "ListenerCertificates", SingularEntity: "Certificate", @@ -296,6 +418,20 @@ var ( `, }, + Function{ + FnName: "GetLoadBalancersV2TargetGroupAttributes", + SingularEntity: "TargetGroupAttribute", + FnAttributeList: "Attributes", + HasNotPagination: true, + Entity: "TargetGroupAttributes", + Prefix: "Describe", + Service: "elbv2", + Documentation: ` + // GetLoadBalancersV2TargetGroupAttributes returns a list of TargetGroupAttributes based on the input from the different regions. + // Returned values are commented in the interface doc comment block. + `, + }, + // rds Function{ Entity: "DBInstances", @@ -865,5 +1001,21 @@ var ( // Returned values are commented in the interface doc comment block. `, }, + + // Lambda + Function{ + FnName: "GetLambdaFunctions", + Entity: "Functions", + FnAttributeList: "Functions", + SingularEntity: "FunctionConfiguration", + Prefix: "List", + Service: "lambda", + FnPaginationAttribute: "NextMarker", + FnInputPaginationAttribute: "Marker", + Documentation: ` + // GetLambdaFunctions returns the lambda Functions on the given input + // Returned values are commented in the interface doc comment block. + `, + }, } ) diff --git a/aws/reader/connector.go b/aws/reader/connector.go index cd19009bc8..a1e21089da 100644 --- a/aws/reader/connector.go +++ b/aws/reader/connector.go @@ -8,6 +8,7 @@ import ( "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/credentials" "github.com/aws/aws-sdk-go/aws/session" + "github.com/aws/aws-sdk-go/service/apigateway/apigatewayiface" "github.com/aws/aws-sdk-go/service/autoscaling/autoscalingiface" "github.com/aws/aws-sdk-go/service/cloudfront/cloudfrontiface" "github.com/aws/aws-sdk-go/service/cloudwatch/cloudwatchiface" @@ -15,9 +16,11 @@ import ( "github.com/aws/aws-sdk-go/service/ec2" "github.com/aws/aws-sdk-go/service/ec2/ec2iface" "github.com/aws/aws-sdk-go/service/elasticache/elasticacheiface" + "github.com/aws/aws-sdk-go/service/elasticsearchservice/elasticsearchserviceiface" "github.com/aws/aws-sdk-go/service/elb/elbiface" "github.com/aws/aws-sdk-go/service/elbv2/elbv2iface" "github.com/aws/aws-sdk-go/service/iam/iamiface" + "github.com/aws/aws-sdk-go/service/lambda/lambdaiface" "github.com/aws/aws-sdk-go/service/rds/rdsiface" "github.com/aws/aws-sdk-go/service/route53/route53iface" "github.com/aws/aws-sdk-go/service/route53resolver/route53resolveriface" @@ -85,23 +88,26 @@ func (c *connector) GetRegion() string { } type serviceConnector struct { - region string - session *session.Session - ec2 ec2iface.EC2API - elb elbiface.ELBAPI - elbv2 elbv2iface.ELBV2API - rds rdsiface.RDSAPI - s3 s3iface.S3API - s3downloader s3manageriface.DownloaderAPI - elasticache elasticacheiface.ElastiCacheAPI - configservice configserviceiface.ConfigServiceAPI - cloudfront cloudfrontiface.CloudFrontAPI - cloudwatch cloudwatchiface.CloudWatchAPI - iam iamiface.IAMAPI - ses sesiface.SESAPI - route53 route53iface.Route53API - route53resolver route53resolveriface.Route53ResolverAPI - autoscaling autoscalingiface.AutoScalingAPI + apigateway apigatewayiface.APIGatewayAPI + autoscaling autoscalingiface.AutoScalingAPI + cloudfront cloudfrontiface.CloudFrontAPI + cloudwatch cloudwatchiface.CloudWatchAPI + configservice configserviceiface.ConfigServiceAPI + ec2 ec2iface.EC2API + elasticache elasticacheiface.ElastiCacheAPI + elasticsearchservice elasticsearchserviceiface.ElasticsearchServiceAPI + elb elbiface.ELBAPI + elbv2 elbv2iface.ELBV2API + iam iamiface.IAMAPI + lambda lambdaiface.LambdaAPI + rds rdsiface.RDSAPI + region string + route53resolver route53resolveriface.Route53ResolverAPI + route53 route53iface.Route53API + s3downloader s3manageriface.DownloaderAPI + s3 s3iface.S3API + ses sesiface.SESAPI + session *session.Session } // configureAWS creates a new static credential with the passed accessKey and diff --git a/aws/resources.go b/aws/resources.go index fa9ea745a3..c57adeae52 100644 --- a/aws/resources.go +++ b/aws/resources.go @@ -3,10 +3,14 @@ package aws import ( "context" "fmt" + "strconv" "strings" awsSDK "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/service/apigateway" "github.com/aws/aws-sdk-go/service/ec2" + "github.com/aws/aws-sdk-go/service/elasticsearchservice" + "github.com/aws/aws-sdk-go/service/elb" "github.com/aws/aws-sdk-go/service/elbv2" "github.com/aws/aws-sdk-go/service/iam" "github.com/aws/aws-sdk-go/service/route53" @@ -28,39 +32,39 @@ const ( // List of all the Resources Instance ResourceType = iota - VPC - VPCPeeringConnection - KeyPair + // Do not have them for now as it's not needed // but works //AMI - SecurityGroup - Subnet - EBSVolume + // Do not have them for now as it's not needed // but works //EBSSnapshot - ElasticacheCluster - ELB + ALB ALBListener - ALBListenerRule ALBListenerCertificate + ALBListenerRule ALBTargetGroup - LB - LBListener - LBListenerRule - LBListenerCertificate - LBTargetGroup - DBInstance - DBParameterGroup - DBSubnetGroup - S3Bucket - //S3BucketObject + ALBTargetGroupAttachment + APIGatewayDeployment + APIGatewayStage + APIGatewayResource + APIGatewayRestAPI + AutoscalingGroup + AutoscalingPolicy CloudfrontDistribution CloudfrontOriginAccessIdentity CloudfrontPublicKey CloudwatchMetricAlarm + DBInstance + DBParameterGroup + DBSubnetGroup + EBSVolume + ElasticacheCluster + ElasticsearchDomain + ElasticsearchDomainPolicy + ELB IAMAccessKey IAMAccountAlias IAMAccountPasswordPolicy @@ -85,110 +89,135 @@ const ( IAMUserPolicy IAMUserPolicyAttachment IAMUserSSHKey + KeyPair + LambdaFunction + LaunchConfiguration + LaunchTemplate + LB + LBCookieStickinessPolicy + LBListener + LBListenerCertificate + LBListenerRule + LBTargetGroup + LBTargetGroupAttachment Route53DelegationSet Route53HealthCheck Route53QueryLog Route53Record - Route53Zone - Route53ZoneAssociation Route53ResolverEndpoint Route53ResolverRuleAssociation + Route53Zone + Route53ZoneAssociation + S3Bucket + //S3BucketObject + SecurityGroup SESActiveReceiptRuleSet + SESConfigurationSet + SESDomainDKIM SESDomainIdentity SESDomainIdentityVerification - SESDomainDKIM SESDomainMailFrom - SESReceiptFilter - SESReceiptRule - SESReceiptRuleSet - SESConfigurationSet // Read on TF is nil so ... // SESEventDestination SESIdentityNotificationTopic + SESReceiptFilter + SESReceiptRule + SESReceiptRuleSet SESTemplate - LaunchConfiguration - LaunchTemplate - AutoscalingGroup - AutoscalingPolicy + Subnet + VolumeAttachment + VPC + VPCPeeringConnection ) type rtFn func(ctx context.Context, a *aws, resourceType string, filters *filter.Filter) ([]provider.Resource, error) var ( resources = map[ResourceType]rtFn{ - Instance: instances, - VPC: vpcs, - VPCPeeringConnection: vpcPeeringConnections, - KeyPair: keyPairs, + ALB: cacheLoadBalancersV2, + ALBListener: cacheLoadBalancersV2Listeners, + ALBListenerCertificate: albListenerCertificates, + ALBListenerRule: albListenerRules, + ALBTargetGroup: albTargetGroups, + ALBTargetGroupAttachment: albTargetGroupAttachments, //AMI: ami, - SecurityGroup: securityGroups, - Subnet: subnets, - EBSVolume: ebsVolumes, - //EBSSnapshot: ebsSnapshots, - ElasticacheCluster: elasticacheClusters, - ELB: elbs, - ALB: cacheLoadBalancersV2, - ALBListener: cacheLoadBalancersV2Listeners, - ALBListenerRule: albListenerRules, - ALBListenerCertificate: albListenerCertificates, - ALBTargetGroup: albTargetGroups, - LB: cacheLoadBalancersV2, - LBListener: cacheLoadBalancersV2Listeners, - LBListenerRule: albListenerRules, - LBListenerCertificate: albListenerCertificates, - LBTargetGroup: albTargetGroups, - DBInstance: dbInstances, - DBParameterGroup: dbParameterGroups, - DBSubnetGroup: dbSubnetGroups, - S3Bucket: s3Buckets, - //S3BucketObject: s3_bucket_objects, + APIGatewayDeployment: apiGatewayDeployments, + APIGatewayStage: apiGatewayStages, + APIGatewayResource: apiGatewayResources, + APIGatewayRestAPI: apiGatewayRestApis, + AutoscalingGroup: autoscalingGroups, + AutoscalingPolicy: autoscalingPolicies, CloudfrontDistribution: cloudfrontDistributions, CloudfrontOriginAccessIdentity: cloudfrontOriginAccessIdentities, CloudfrontPublicKey: cloudfrontPublicKeys, CloudwatchMetricAlarm: cloudwatchMetricAlarms, + DBInstance: dbInstances, + DBParameterGroup: dbParameterGroups, + DBSubnetGroup: dbSubnetGroups, + //EBSSnapshot: ebsSnapshots, + EBSVolume: ebsVolumes, + ElasticacheCluster: elasticacheClusters, + ElasticsearchDomain: elasticsearchDomains, + ElasticsearchDomainPolicy: elasticsearchDomains, + ELB: elbs, IAMAccessKey: iamAccessKeys, IAMAccountAlias: iamAccountAliases, IAMAccountPasswordPolicy: iamAccountPasswordPolicy, IAMGroup: cacheIAMGroups, IAMGroupMembership: iamGroupMemberships, - IAMGroupPolicy: iamGroupPolicies, IAMGroupPolicyAttachment: iamGroupPolicyAttachments, + IAMGroupPolicy: iamGroupPolicies, IAMInstanceProfile: iamInstanceProfiles, IAMOpenidConnectProvider: iamOpenidConnectProviders, IAMPolicy: iamPolicies, IAMRole: cacheIAMRoles, - IAMRolePolicy: iamRolePolicies, IAMRolePolicyAttachment: iamRolePolicyAttachments, + IAMRolePolicy: iamRolePolicies, IAMSAMLProvider: iamSAMLProviders, IAMServerCertificate: iamServerCertificates, IAMUser: cacheIAMUsers, IAMUserGroupMembership: iamUserGroupMemberships, - IAMUserPolicy: iamUserPolicies, IAMUserPolicyAttachment: iamUserPolicyAttachments, + IAMUserPolicy: iamUserPolicies, IAMUserSSHKey: iamUserSSHKeys, + Instance: instances, + KeyPair: keyPairs, + LambdaFunction: lambdaFunctions, + LaunchConfiguration: launchConfigurations, + LaunchTemplate: launchTemplates, + LB: cacheLoadBalancersV2, + LBCookieStickinessPolicy: lbCookieStickinessPolicies, + LBListener: cacheLoadBalancersV2Listeners, + LBListenerCertificate: albListenerCertificates, + LBListenerRule: albListenerRules, + LBTargetGroup: albTargetGroups, + LBTargetGroupAttachment: albTargetGroupAttachments, Route53DelegationSet: route53DelegationSets, Route53HealthCheck: route53HealthChecks, Route53QueryLog: route53QueryLogs, Route53Record: route53Records, - Route53Zone: cacheRoute53Zones, - Route53ZoneAssociation: route53ZoneAssociations, Route53ResolverEndpoint: route53ResolverEndpoints, Route53ResolverRuleAssociation: route53ResolverRuleAssociation, - SESActiveReceiptRuleSet: sesActiveReceiptRuleSets, - SESDomainIdentity: cacheSESDomainIdentities, - SESDomainIdentityVerification: sesDomainGeneral, - SESDomainDKIM: sesDomainGeneral, - SESDomainMailFrom: sesDomainGeneral, - SESReceiptFilter: sesReceiptFilters, - SESReceiptRule: sesReceiptRules, - SESReceiptRuleSet: sesReceiptRuleSets, - SESConfigurationSet: sesConfigurationSets, - SESIdentityNotificationTopic: sesIdentityNotificationTopics, - SESTemplate: sesTemplates, - LaunchConfiguration: launchConfigurations, - LaunchTemplate: launchTemplates, - AutoscalingGroup: autoscalingGroups, - AutoscalingPolicy: autoscalingPolicies, + Route53ZoneAssociation: route53ZoneAssociations, + Route53Zone: cacheRoute53Zones, + //S3BucketObject: s3_bucket_objects, + S3Bucket: s3Buckets, + SecurityGroup: securityGroups, + SESActiveReceiptRuleSet: sesActiveReceiptRuleSets, + SESConfigurationSet: sesConfigurationSets, + SESDomainDKIM: sesDomainGeneral, + SESDomainIdentity: cacheSESDomainIdentities, + SESDomainIdentityVerification: sesDomainGeneral, + SESDomainMailFrom: sesDomainGeneral, + SESIdentityNotificationTopic: sesIdentityNotificationTopics, + SESReceiptFilter: sesReceiptFilters, + SESReceiptRule: sesReceiptRules, + SESReceiptRuleSet: sesReceiptRuleSets, + SESTemplate: sesTemplates, + Subnet: subnets, + VolumeAttachment: volumeAttachments, + VPCPeeringConnection: vpcPeeringConnections, + VPC: vpcs, } ) @@ -368,6 +397,12 @@ func ebsVolumes(ctx context.Context, a *aws, resourceType string, filters *filte resources := make([]provider.Resource, 0) for _, v := range volumes { + + // if aws_instance defined, attached volume are done by ebs_block_device block. + if (len(v.Attachments) != 0) && (filters.IsIncluded("aws_instance") && !filters.IsExcluded("aws_instance")) { + continue + } + r, err := initializeResource(a, *v.VolumeId, resourceType) if err != nil { return nil, err @@ -378,6 +413,36 @@ func ebsVolumes(ctx context.Context, a *aws, resourceType string, filters *filte return resources, nil } +func volumeAttachments(ctx context.Context, a *aws, resourceType string, filters *filter.Filter) ([]provider.Resource, error) { + // if aws_instance defined, attachment are done by ebs_block_device block. + if filters.IsIncluded("aws_instance") && !filters.IsExcluded("aws_instance") { + return nil, nil + } + + var input = &ec2.DescribeVolumesInput{ + Filters: toEC2Filters(filters), + } + + volumes, err := a.awsr.GetVolumes(ctx, input) + if err != nil { + return nil, err + } + + resources := make([]provider.Resource, 0) + + for _, v := range volumes { + for _, attach := range v.Attachments { + r, err := initializeResource(a, fmt.Sprintf("%s:%s:%s", *attach.Device, *v.VolumeId, *attach.InstanceId), resourceType) + if err != nil { + return nil, err + } + resources = append(resources, r) + } + } + + return resources, nil +} + //func ebsSnapshots(ctx context.Context, a *aws, resourceType string, filters *filter.Filter) ([]provider.Resource, error) { //var input = &ec2.DescribeSnapshotsInput{ //Filters: toEC2Filters(filters), @@ -418,6 +483,73 @@ func elasticacheClusters(ctx context.Context, a *aws, resourceType string, filte return resources, nil } +func elasticsearchDomains(ctx context.Context, a *aws, resourceType string, filters *filter.Filter) ([]provider.Resource, error) { + // this function is use for both aws_elasticsearch_domain and aws_elasticsearch_domain_policy + // if both defined, execute only aws_elasticsearch_domain + if filters.IsIncluded("aws_elasticsearch_domain", "aws_elasticsearch_domain_policy") && (!filters.IsExcluded("aws_elasticsearch_domain") && resourceType == "aws_elasticsearch_domain_policy") { + return nil, nil + } + + dnames, err := a.awsr.GetElasticsearchDomainNames(ctx, nil) + if err != nil { + return nil, err + } + + var names []*string + for _, dn := range dnames { + names = append(names, dn.DomainName) + } + + input := &elasticsearchservice.DescribeElasticsearchDomainsInput{ + DomainNames: names, + } + + domains, err := a.awsr.GetElasticsearchDomains(ctx, input) + if err != nil { + return nil, err + } + + resources := make([]provider.Resource, 0) + for _, d := range domains { + + if resourceType == "aws_elasticsearch_domain" { + // Generate aws_elasticsearch_domain + r, err := initializeResource(a, *d.DomainName, resourceType) + if err != nil { + return nil, err + } + + resources = append(resources, r) + } + + // if aws_elasticsearch_domain_policy, create resource + if resourceType == "aws_elasticsearch_domain_policy" { + // Generate aws_elasticsearch_domain_policy + r2, err := initializeResource(a, *d.DomainName, resourceType) + if err != nil { + return nil, err + } + // TODO this resource is not importable. Define our own ResourceImporter + // Should be removed when terraform will support it + // more detail: https://github.com/cycloidio/terracognita/issues/120 + importer := &schema.ResourceImporter{ + State: func(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { + d.Set("domain_name", d.Id()) + d.SetId("esd-policy-" + d.Id()) + + return []*schema.ResourceData{d}, nil + }, + } + + r2.SetImporter(importer) + resources = append(resources, r2) + } + + } + + return resources, nil +} + func elbs(ctx context.Context, a *aws, resourceType string, filters *filter.Filter) ([]provider.Resource, error) { lbs, err := a.awsr.GetLoadBalancers(ctx, nil) if err != nil { @@ -436,6 +568,69 @@ func elbs(ctx context.Context, a *aws, resourceType string, filters *filter.Filt return resources, nil } +func lbCookieStickinessPolicies(ctx context.Context, a *aws, resourceType string, filters *filter.Filter) ([]provider.Resource, error) { + lbs, err := a.awsr.GetLoadBalancers(ctx, nil) + if err != nil { + return nil, err + } + + resources := make([]provider.Resource, 0) + + for _, l := range lbs { + for _, listener := range l.ListenerDescriptions { + input := &elb.DescribeLoadBalancerPoliciesInput{ + LoadBalancerName: l.LoadBalancerName, + PolicyNames: listener.PolicyNames, + } + + policies, err := a.awsr.GetLoadBalancerPolicies(ctx, input) + if err != nil { + return nil, err + } + for _, i := range policies { + if *i.PolicyTypeName == "LBCookieStickinessPolicyType" { + //lbName, lbPort, policyName + r, err := initializeResource(a, fmt.Sprintf("%s:%d:%s", *l.LoadBalancerName, *listener.Listener.LoadBalancerPort, *i.PolicyName), resourceType) + if err != nil { + return nil, err + } + + // TODO this resource is not importable. Define our own ResourceImporter + // Should be removed when terraform will support it + // more detail: https://github.com/cycloidio/terracognita/issues/120 + importer := &schema.ResourceImporter{ + State: func(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { + parts := strings.SplitN(d.Id(), ":", 3) + + if len(parts) != 3 || parts[0] == "" || parts[1] == "" || parts[2] == "" { + return nil, fmt.Errorf("unexpected format of ID (%s), expected lbName:lbPort:policyName", d.Id()) + } + + lbPort, err := strconv.Atoi(parts[1]) + if err != nil { + return nil, fmt.Errorf("unexpected loadbalancer port (%s)", parts[1]) + } + + d.Set("load_balancer", parts[0]) + d.Set("lb_port", lbPort) + d.Set("name", fmt.Sprintf("%s-%s-stickiness", parts[0], parts[1])) + d.SetId(fmt.Sprintf("%s:%s:%s", parts[0], parts[1], parts[2])) + + return []*schema.ResourceData{d}, nil + }, + } + + r.SetImporter(importer) + + resources = append(resources, r) + } + } + } + } + + return resources, nil +} + func albs(ctx context.Context, a *aws, resourceType string, filters *filter.Filter) ([]provider.Resource, error) { lbs, err := a.awsr.GetLoadBalancersV2(ctx, nil) if err != nil { @@ -529,6 +724,11 @@ func albListenerCertificates(ctx context.Context, a *aws, resourceType string, f return nil, nil } + albListernerIncluded := false + if (filters.IsIncluded("aws_alb_listener") && !filters.IsExcluded("aws_alb_listener")) || (filters.IsIncluded("aws_lb_listener") && !filters.IsExcluded("aws_lb_listener")) { + albListernerIncluded = true + } + ALBListeners, err := getLoadBalancersV2ListenersArns(ctx, a, ALBListener.String(), filters) if err != nil { return nil, err @@ -548,22 +748,41 @@ func albListenerCertificates(ctx context.Context, a *aws, resourceType string, f } for _, i := range albListenerCertificates { + // if filter include aws_alb_listener, check if *i.IsDefault not defined (since default it is already written by aws_alb_listener) + if albListernerIncluded && *i.IsDefault { + continue + } - // TODO: if filter include aws_alb_listener, check if *i.IsDefault not append (since it is already written by aws_alb_listener) - r, err := initializeResource(a, *i.CertificateArn, resourceType) - + r, err := initializeResource(a, fmt.Sprintf("%s_%s", l, *i.CertificateArn), resourceType) if err != nil { return nil, err } + // TODO this resource is not importable. Define our own ResourceImporter + // Should be removed when terraform will support it + // more detail: https://github.com/cycloidio/terracognita/issues/120 + importer := &schema.ResourceImporter{ + State: func(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { + parts := strings.SplitN(d.Id(), "_", 2) + + if len(parts) != 2 || parts[0] == "" || parts[1] == "" { + return nil, fmt.Errorf("unexpected format of ID (%s), expected listenerArn_certificateArn", d.Id()) + } + d.Set("listener_arn", parts[0]) + d.Set("certificate_arn", parts[1]) + d.SetId(fmt.Sprintf("%s_%s", parts[0], parts[1])) + + return []*schema.ResourceData{d}, nil + }, + } + + r.SetImporter(importer) + resources = append(resources, r) } } - // TODO: This resource it's not Importable yet (https://www.terraform.io/docs/providers/aws/r/lb_listener_certificate.html) - // https://github.com/cycloidio/terracognita/issues/91 - return nil, nil - //return resources, nil + return resources, nil } func albTargetGroups(ctx context.Context, a *aws, resourceType string, filters *filter.Filter) ([]provider.Resource, error) { @@ -591,6 +810,70 @@ func albTargetGroups(ctx context.Context, a *aws, resourceType string, filters * return resources, nil } +func albTargetGroupAttachments(ctx context.Context, a *aws, resourceType string, filters *filter.Filter) ([]provider.Resource, error) { + // if both defined, keep only aws_alb_target_group_attachment + if filters.IsIncluded("aws_alb_target_group_attachment", "aws_lb_target_group_attachment") && (!filters.IsExcluded("aws_alb_target_group_attachment") && resourceType == "aws_lb_target_group_attachment") { + return nil, nil + } + + albTargetGroups, err := a.awsr.GetLoadBalancersV2TargetGroups(ctx, nil) + if err != nil { + return nil, err + } + + resources := make([]provider.Resource, 0) + for _, i := range albTargetGroups { + + input := &elbv2.DescribeTargetHealthInput{ + TargetGroupArn: i.TargetGroupArn, + } + + targetHealths, err := a.awsr.GetLoadBalancersV2TargetHealth(ctx, input) + if err != nil { + return nil, err + } + + for _, t := range targetHealths { + r, err := initializeResource(a, fmt.Sprintf("%s_%d_%s", *t.Target.Id, *t.Target.Port, *i.TargetGroupArn), resourceType) + if err != nil { + return nil, err + } + + // TODO this resource is not importable. Define our own ResourceImporter + // Should be removed when terraform will support it + // more detail: https://github.com/cycloidio/terracognita/issues/120 + importer := &schema.ResourceImporter{ + State: func(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { + parts := strings.SplitN(d.Id(), "_", 3) + + if len(parts) != 3 || parts[0] == "" || parts[1] == "" || parts[2] == "" { + return nil, fmt.Errorf("unexpected format of ID (%s), expected targetId_port_TargetGroupArn", d.Id()) + } + + tPort, err := strconv.Atoi(parts[1]) + if err != nil { + return nil, fmt.Errorf("unexpected target port (%s)", parts[1]) + } + + d.Set("target_id", parts[0]) + d.Set("port", tPort) + d.Set("target_group_arn", parts[2]) + + d.SetId(resource.PrefixedUniqueId(fmt.Sprintf("%s-", parts[2]))) + + return []*schema.ResourceData{d}, nil + }, + } + + r.SetImporter(importer) + + resources = append(resources, r) + } + } + + return resources, nil +} + func dbInstances(ctx context.Context, a *aws, resourceType string, filters *filter.Filter) ([]provider.Resource, error) { dbs, err := a.awsr.GetDBInstances(ctx, nil) if err != nil { @@ -1605,6 +1888,27 @@ func sesTemplates(ctx context.Context, a *aws, resourceType string, filters *fil return resources, nil } +func lambdaFunctions(ctx context.Context, a *aws, resourceType string, filters *filter.Filter) ([]provider.Resource, error) { + lambdaFunctions, err := a.awsr.GetLambdaFunctions(ctx, nil) + + if err != nil { + return nil, err + } + + resources := make([]provider.Resource, 0) + for _, i := range lambdaFunctions { + + r, err := initializeResource(a, *i.FunctionName, resourceType) + if err != nil { + return nil, err + } + + resources = append(resources, r) + } + + return resources, nil +} + func launchConfigurations(ctx context.Context, a *aws, resourceType string, filters *filter.Filter) ([]provider.Resource, error) { launchConfigurations, err := a.awsr.GetLaunchConfigurations(ctx, nil) @@ -1651,6 +1955,141 @@ func launchTemplates(ctx context.Context, a *aws, resourceType string, filters * return resources, nil } +func apiGatewayDeployments(ctx context.Context, a *aws, resourceType string, filters *filter.Filter) ([]provider.Resource, error) { + + apiGatewayRestApis, err := getAPIGatewayRestApis(ctx, a, APIGatewayRestAPI.String(), filters) + if err != nil { + return nil, err + } + + resources := make([]provider.Resource, 0) + for _, rapi := range apiGatewayRestApis { + + var input = &apigateway.GetDeploymentsInput{ + RestApiId: awsSDK.String(rapi), + } + + apiGatewayDeployments, err := a.awsr.GetAPIGatewayDeployments(ctx, input) + if err != nil { + return nil, err + } + + for _, i := range apiGatewayDeployments { + + r, err := initializeResource(a, fmt.Sprintf("%s:%s", *i.Id, rapi), resourceType) + if err != nil { + return nil, err + } + + // TODO this resource is not importable. Define our own ResourceImporter + // Should be removed when terraform will support it + // more detail: https://github.com/cycloidio/terracognita/issues/120 + importer := &schema.ResourceImporter{ + State: func(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { + parts := strings.SplitN(d.Id(), ":", 2) + + if len(parts) != 2 || parts[0] == "" || parts[1] == "" { + return nil, fmt.Errorf("unexpected format of ID (%s), expected targetId_port_TargetGroupArn", d.Id()) + } + + d.Set("rest_api_id", parts[1]) + d.SetId(parts[0]) + + return []*schema.ResourceData{d}, nil + }, + } + + r.SetImporter(importer) + + resources = append(resources, r) + } + } + return resources, nil +} + +func apiGatewayStages(ctx context.Context, a *aws, resourceType string, filters *filter.Filter) ([]provider.Resource, error) { + + apiGatewayRestApis, err := getAPIGatewayRestApis(ctx, a, APIGatewayRestAPI.String(), filters) + if err != nil { + return nil, err + } + + resources := make([]provider.Resource, 0) + for _, rapi := range apiGatewayRestApis { + + var input = &apigateway.GetStagesInput{ + RestApiId: awsSDK.String(rapi), + } + + apiGatewayStages, err := a.awsr.GetAPIGatewayStages(ctx, input) + if err != nil { + return nil, err + } + + for _, i := range apiGatewayStages { + r, err := initializeResource(a, fmt.Sprintf("%s/%s", rapi, *i.StageName), resourceType) + if err != nil { + return nil, err + } + + resources = append(resources, r) + } + } + return resources, nil +} + +func apiGatewayResources(ctx context.Context, a *aws, resourceType string, filters *filter.Filter) ([]provider.Resource, error) { + + apiGatewayRestApis, err := getAPIGatewayRestApis(ctx, a, APIGatewayRestAPI.String(), filters) + if err != nil { + return nil, err + } + + resources := make([]provider.Resource, 0) + for _, rapi := range apiGatewayRestApis { + + var input = &apigateway.GetResourcesInput{ + RestApiId: awsSDK.String(rapi), + } + + apiGatewayResources, err := a.awsr.GetAPIGatewayResources(ctx, input) + if err != nil { + return nil, err + } + + for _, i := range apiGatewayResources { + r, err := initializeResource(a, fmt.Sprintf("%s/%s", rapi, *i.Id), resourceType) + if err != nil { + return nil, err + } + + resources = append(resources, r) + } + } + return resources, nil +} + +func apiGatewayRestApis(ctx context.Context, a *aws, resourceType string, filters *filter.Filter) ([]provider.Resource, error) { + apiGatewayRestApis, err := a.awsr.GetAPIGatewayRestAPIs(ctx, nil) + + if err != nil { + return nil, err + } + + resources := make([]provider.Resource, 0) + for _, i := range apiGatewayRestApis { + + r, err := initializeResource(a, *i.Id, resourceType) + if err != nil { + return nil, err + } + + resources = append(resources, r) + } + + return resources, nil +} + func autoscalingGroups(ctx context.Context, a *aws, resourceType string, filters *filter.Filter) ([]provider.Resource, error) { autoscalingGroups, err := a.awsr.GetAutoScalingGroups(ctx, nil) From f68c594c7011d7cdc2ddecf3f92296da81daa7a5 Mon Sep 17 00:00:00 2001 From: talset Date: Wed, 15 Jul 2020 15:58:10 +0200 Subject: [PATCH 3/3] generate: update generated files --- aws/reader/reader.go | 360 +++++++++++++++++++++++++++++ aws/resourcetype_enumer.go | 449 ++++++++++++++++++++----------------- 2 files changed, 601 insertions(+), 208 deletions(-) diff --git a/aws/reader/reader.go b/aws/reader/reader.go index 4d46e9ff47..779ca003cb 100644 --- a/aws/reader/reader.go +++ b/aws/reader/reader.go @@ -3,15 +3,18 @@ package reader import ( "context" + "github.com/aws/aws-sdk-go/service/apigateway" "github.com/aws/aws-sdk-go/service/autoscaling" "github.com/aws/aws-sdk-go/service/cloudfront" "github.com/aws/aws-sdk-go/service/cloudwatch" "github.com/aws/aws-sdk-go/service/configservice" "github.com/aws/aws-sdk-go/service/ec2" "github.com/aws/aws-sdk-go/service/elasticache" + "github.com/aws/aws-sdk-go/service/elasticsearchservice" "github.com/aws/aws-sdk-go/service/elb" "github.com/aws/aws-sdk-go/service/elbv2" "github.com/aws/aws-sdk-go/service/iam" + "github.com/aws/aws-sdk-go/service/lambda" "github.com/aws/aws-sdk-go/service/rds" "github.com/aws/aws-sdk-go/service/route53" "github.com/aws/aws-sdk-go/service/route53resolver" @@ -45,6 +48,22 @@ type Reader interface { // GetRegion returns the currently used region for the Connector GetRegion() string + // GetAPIGatewayDeployments returns the Deployment Functions on the given input + // Returned values are commented in the interface doc comment block. + GetAPIGatewayDeployments(ctx context.Context, input *apigateway.GetDeploymentsInput) ([]*apigateway.Deployment, error) + + // GetAPIGatewayRestAPIs returns the RestApi Functions on the given input + // Returned values are commented in the interface doc comment block. + GetAPIGatewayRestAPIs(ctx context.Context, input *apigateway.GetRestApisInput) ([]*apigateway.RestApi, error) + + // GetAPIGatewayStages returns the Stage Functions on the given input + // Returned values are commented in the interface doc comment block. + GetAPIGatewayStages(ctx context.Context, input *apigateway.GetStagesInput) ([]*apigateway.Stage, error) + + // GetAPIGatewayResources returns the Resource Functions on the given input + // Returned values are commented in the interface doc comment block. + GetAPIGatewayResources(ctx context.Context, input *apigateway.GetResourcesInput) ([]*apigateway.Resource, error) + // GetMetricAlarms returns all cloudwatch alarms based on the input given. // Returned values are commented in the interface doc comment block. GetMetricAlarms(ctx context.Context, input *cloudwatch.DescribeAlarmsInput) ([]*cloudwatch.MetricAlarm, error) @@ -117,6 +136,14 @@ type Reader interface { // Returned values are commented in the interface doc comment block. GetElastiCacheTags(ctx context.Context, input *elasticache.ListTagsForResourceInput) ([]*elasticache.Tag, error) + // GetElasticsearchDomains returns a list of domains of Elasticsearch resources. + // Returned values are commented in the interface doc comment block. + GetElasticsearchDomains(ctx context.Context, input *elasticsearchservice.DescribeElasticsearchDomainsInput) ([]*elasticsearchservice.ElasticsearchDomainStatus, error) + + // GetElasticsearchDomainNames returns a list of domainNames of Elasticsearch resources. + // Returned values are commented in the interface doc comment block. + GetElasticsearchDomainNames(ctx context.Context, input *elasticsearchservice.ListDomainNamesInput) ([]*elasticsearchservice.DomainInfo, error) + // GetLoadBalancers returns a list of ELB (v1) based on the input from the different regions. // Returned values are commented in the interface doc comment block. GetLoadBalancers(ctx context.Context, input *elb.DescribeLoadBalancersInput) ([]*elb.LoadBalancerDescription, error) @@ -125,6 +152,14 @@ type Reader interface { // Returned values are commented in the interface doc comment block. GetLoadBalancersTags(ctx context.Context, input *elb.DescribeTagsInput) ([]*elb.TagDescription, error) + // GetLoadBalancerAttributes returns a list of Attributes based on the input from the different regions. + // Returned values are commented in the interface doc comment block. + GetLoadBalancerAttributes(ctx context.Context, input *elb.DescribeLoadBalancerAttributesInput) ([]*elb.AdditionalAttribute, error) + + // GetLoadBalancerPolicies returns a list of Policies based on the input from the different regions. + // Returned values are commented in the interface doc comment block. + GetLoadBalancerPolicies(ctx context.Context, input *elb.DescribeLoadBalancerPoliciesInput) ([]*elb.PolicyDescription, error) + // GetLoadBalancersV2 returns a list of ELB (v2) - also known as ALB - based on the input from the different regions. // Returned values are commented in the interface doc comment block. GetLoadBalancersV2(ctx context.Context, input *elbv2.DescribeLoadBalancersInput) ([]*elbv2.LoadBalancer, error) @@ -141,6 +176,10 @@ type Reader interface { // Returned values are commented in the interface doc comment block. GetLoadBalancersV2TargetGroups(ctx context.Context, input *elbv2.DescribeTargetGroupsInput) ([]*elbv2.TargetGroup, error) + // GetLoadBalancersV2TargetHealth returns a list of TargetHealth based on the input from the different regions. + // Returned values are commented in the interface doc comment block. + GetLoadBalancersV2TargetHealth(ctx context.Context, input *elbv2.DescribeTargetHealthInput) ([]*elbv2.TargetHealthDescription, error) + // GetListenerCertificates returns a list of ListenerCertificates based on the input from the different regions. // Returned values are commented in the interface doc comment block. GetListenerCertificates(ctx context.Context, input *elbv2.DescribeListenerCertificatesInput) ([]*elbv2.Certificate, error) @@ -149,6 +188,10 @@ type Reader interface { // Returned values are commented in the interface doc comment block. GetLoadBalancersV2Rules(ctx context.Context, input *elbv2.DescribeRulesInput) ([]*elbv2.Rule, error) + // GetLoadBalancersV2TargetGroupAttributes returns a list of TargetGroupAttributes based on the input from the different regions. + // Returned values are commented in the interface doc comment block. + GetLoadBalancersV2TargetGroupAttributes(ctx context.Context, input *elbv2.DescribeTargetGroupAttributesInput) ([]*elbv2.TargetGroupAttribute, error) + // GetDBInstances returns all DB instances based on the input given. // Returned values are commented in the interface doc comment block. GetDBInstances(ctx context.Context, input *rds.DescribeDBInstancesInput) ([]*rds.DBInstance, error) @@ -344,6 +387,130 @@ type Reader interface { // GetResolverRuleAssociations returns the Route53Resolver ResolverRuleAssociations on the given input // Returned values are commented in the interface doc comment block. GetResolverRuleAssociations(ctx context.Context, input *route53resolver.ListResolverRuleAssociationsInput) ([]*route53resolver.ResolverRuleAssociation, error) + + // GetLambdaFunctions returns the lambda Functions on the given input + // Returned values are commented in the interface doc comment block. + GetLambdaFunctions(ctx context.Context, input *lambda.ListFunctionsInput) ([]*lambda.FunctionConfiguration, error) +} + +func (c *connector) GetAPIGatewayDeployments(ctx context.Context, input *apigateway.GetDeploymentsInput) ([]*apigateway.Deployment, error) { + if c.svc.apigateway == nil { + c.svc.apigateway = apigateway.New(c.svc.session) + } + + opt := make([]*apigateway.Deployment, 0) + + hasNextToken := true + for hasNextToken { + o, err := c.svc.apigateway.GetDeploymentsWithContext(ctx, input) + if err != nil { + return nil, err + } + if o.Items == nil { + hasNextToken = false + continue + } + + if input == nil { + input = &apigateway.GetDeploymentsInput{} + } + input.Position = o.Position + hasNextToken = o.Position != nil + + opt = append(opt, o.Items...) + + } + + return opt, nil +} + +func (c *connector) GetAPIGatewayRestAPIs(ctx context.Context, input *apigateway.GetRestApisInput) ([]*apigateway.RestApi, error) { + if c.svc.apigateway == nil { + c.svc.apigateway = apigateway.New(c.svc.session) + } + + opt := make([]*apigateway.RestApi, 0) + + hasNextToken := true + for hasNextToken { + o, err := c.svc.apigateway.GetRestApisWithContext(ctx, input) + if err != nil { + return nil, err + } + if o.Items == nil { + hasNextToken = false + continue + } + + if input == nil { + input = &apigateway.GetRestApisInput{} + } + input.Position = o.Position + hasNextToken = o.Position != nil + + opt = append(opt, o.Items...) + + } + + return opt, nil +} + +func (c *connector) GetAPIGatewayStages(ctx context.Context, input *apigateway.GetStagesInput) ([]*apigateway.Stage, error) { + if c.svc.apigateway == nil { + c.svc.apigateway = apigateway.New(c.svc.session) + } + + opt := make([]*apigateway.Stage, 0) + + hasNextToken := true + for hasNextToken { + o, err := c.svc.apigateway.GetStagesWithContext(ctx, input) + if err != nil { + return nil, err + } + if o.Item == nil { + hasNextToken = false + continue + } + + hasNextToken = false + + opt = append(opt, o.Item...) + + } + + return opt, nil +} + +func (c *connector) GetAPIGatewayResources(ctx context.Context, input *apigateway.GetResourcesInput) ([]*apigateway.Resource, error) { + if c.svc.apigateway == nil { + c.svc.apigateway = apigateway.New(c.svc.session) + } + + opt := make([]*apigateway.Resource, 0) + + hasNextToken := true + for hasNextToken { + o, err := c.svc.apigateway.GetResourcesWithContext(ctx, input) + if err != nil { + return nil, err + } + if o.Items == nil { + hasNextToken = false + continue + } + + if input == nil { + input = &apigateway.GetResourcesInput{} + } + input.Position = o.Position + hasNextToken = o.Position != nil + + opt = append(opt, o.Items...) + + } + + return opt, nil } func (c *connector) GetMetricAlarms(ctx context.Context, input *cloudwatch.DescribeAlarmsInput) ([]*cloudwatch.MetricAlarm, error) { @@ -900,6 +1067,60 @@ func (c *connector) GetElastiCacheTags(ctx context.Context, input *elasticache.L return opt, nil } +func (c *connector) GetElasticsearchDomains(ctx context.Context, input *elasticsearchservice.DescribeElasticsearchDomainsInput) ([]*elasticsearchservice.ElasticsearchDomainStatus, error) { + if c.svc.elasticsearchservice == nil { + c.svc.elasticsearchservice = elasticsearchservice.New(c.svc.session) + } + + opt := make([]*elasticsearchservice.ElasticsearchDomainStatus, 0) + + hasNextToken := true + for hasNextToken { + o, err := c.svc.elasticsearchservice.DescribeElasticsearchDomainsWithContext(ctx, input) + if err != nil { + return nil, err + } + if o.DomainStatusList == nil { + hasNextToken = false + continue + } + + hasNextToken = false + + opt = append(opt, o.DomainStatusList...) + + } + + return opt, nil +} + +func (c *connector) GetElasticsearchDomainNames(ctx context.Context, input *elasticsearchservice.ListDomainNamesInput) ([]*elasticsearchservice.DomainInfo, error) { + if c.svc.elasticsearchservice == nil { + c.svc.elasticsearchservice = elasticsearchservice.New(c.svc.session) + } + + opt := make([]*elasticsearchservice.DomainInfo, 0) + + hasNextToken := true + for hasNextToken { + o, err := c.svc.elasticsearchservice.ListDomainNamesWithContext(ctx, input) + if err != nil { + return nil, err + } + if o.DomainNames == nil { + hasNextToken = false + continue + } + + hasNextToken = false + + opt = append(opt, o.DomainNames...) + + } + + return opt, nil +} + func (c *connector) GetLoadBalancers(ctx context.Context, input *elb.DescribeLoadBalancersInput) ([]*elb.LoadBalancerDescription, error) { if c.svc.elb == nil { c.svc.elb = elb.New(c.svc.session) @@ -958,6 +1179,60 @@ func (c *connector) GetLoadBalancersTags(ctx context.Context, input *elb.Describ return opt, nil } +func (c *connector) GetLoadBalancerAttributes(ctx context.Context, input *elb.DescribeLoadBalancerAttributesInput) ([]*elb.AdditionalAttribute, error) { + if c.svc.elb == nil { + c.svc.elb = elb.New(c.svc.session) + } + + opt := make([]*elb.AdditionalAttribute, 0) + + hasNextToken := true + for hasNextToken { + o, err := c.svc.elb.DescribeLoadBalancerAttributesWithContext(ctx, input) + if err != nil { + return nil, err + } + if o.LoadBalancerAttributes == nil { + hasNextToken = false + continue + } + + hasNextToken = false + + opt = append(opt, o.LoadBalancerAttributes.AdditionalAttributes...) + + } + + return opt, nil +} + +func (c *connector) GetLoadBalancerPolicies(ctx context.Context, input *elb.DescribeLoadBalancerPoliciesInput) ([]*elb.PolicyDescription, error) { + if c.svc.elb == nil { + c.svc.elb = elb.New(c.svc.session) + } + + opt := make([]*elb.PolicyDescription, 0) + + hasNextToken := true + for hasNextToken { + o, err := c.svc.elb.DescribeLoadBalancerPoliciesWithContext(ctx, input) + if err != nil { + return nil, err + } + if o.PolicyDescriptions == nil { + hasNextToken = false + continue + } + + hasNextToken = false + + opt = append(opt, o.PolicyDescriptions...) + + } + + return opt, nil +} + func (c *connector) GetLoadBalancersV2(ctx context.Context, input *elbv2.DescribeLoadBalancersInput) ([]*elbv2.LoadBalancer, error) { if c.svc.elbv2 == nil { c.svc.elbv2 = elbv2.New(c.svc.session) @@ -1078,6 +1353,33 @@ func (c *connector) GetLoadBalancersV2TargetGroups(ctx context.Context, input *e return opt, nil } +func (c *connector) GetLoadBalancersV2TargetHealth(ctx context.Context, input *elbv2.DescribeTargetHealthInput) ([]*elbv2.TargetHealthDescription, error) { + if c.svc.elbv2 == nil { + c.svc.elbv2 = elbv2.New(c.svc.session) + } + + opt := make([]*elbv2.TargetHealthDescription, 0) + + hasNextToken := true + for hasNextToken { + o, err := c.svc.elbv2.DescribeTargetHealthWithContext(ctx, input) + if err != nil { + return nil, err + } + if o.TargetHealthDescriptions == nil { + hasNextToken = false + continue + } + + hasNextToken = false + + opt = append(opt, o.TargetHealthDescriptions...) + + } + + return opt, nil +} + func (c *connector) GetListenerCertificates(ctx context.Context, input *elbv2.DescribeListenerCertificatesInput) ([]*elbv2.Certificate, error) { if c.svc.elbv2 == nil { c.svc.elbv2 = elbv2.New(c.svc.session) @@ -1140,6 +1442,33 @@ func (c *connector) GetLoadBalancersV2Rules(ctx context.Context, input *elbv2.De return opt, nil } +func (c *connector) GetLoadBalancersV2TargetGroupAttributes(ctx context.Context, input *elbv2.DescribeTargetGroupAttributesInput) ([]*elbv2.TargetGroupAttribute, error) { + if c.svc.elbv2 == nil { + c.svc.elbv2 = elbv2.New(c.svc.session) + } + + opt := make([]*elbv2.TargetGroupAttribute, 0) + + hasNextToken := true + for hasNextToken { + o, err := c.svc.elbv2.DescribeTargetGroupAttributesWithContext(ctx, input) + if err != nil { + return nil, err + } + if o.Attributes == nil { + hasNextToken = false + continue + } + + hasNextToken = false + + opt = append(opt, o.Attributes...) + + } + + return opt, nil +} + func (c *connector) GetDBInstances(ctx context.Context, input *rds.DescribeDBInstancesInput) ([]*rds.DBInstance, error) { if c.svc.rds == nil { c.svc.rds = rds.New(c.svc.session) @@ -2556,3 +2885,34 @@ func (c *connector) GetResolverRuleAssociations(ctx context.Context, input *rout return opt, nil } + +func (c *connector) GetLambdaFunctions(ctx context.Context, input *lambda.ListFunctionsInput) ([]*lambda.FunctionConfiguration, error) { + if c.svc.lambda == nil { + c.svc.lambda = lambda.New(c.svc.session) + } + + opt := make([]*lambda.FunctionConfiguration, 0) + + hasNextToken := true + for hasNextToken { + o, err := c.svc.lambda.ListFunctionsWithContext(ctx, input) + if err != nil { + return nil, err + } + if o.Functions == nil { + hasNextToken = false + continue + } + + if input == nil { + input = &lambda.ListFunctionsInput{} + } + input.Marker = o.NextMarker + hasNextToken = o.NextMarker != nil + + opt = append(opt, o.Functions...) + + } + + return opt, nil +} diff --git a/aws/resourcetype_enumer.go b/aws/resourcetype_enumer.go index f47cc86c90..a6b2f0c3c9 100644 --- a/aws/resourcetype_enumer.go +++ b/aws/resourcetype_enumer.go @@ -6,11 +6,11 @@ import ( "fmt" ) -const _ResourceTypeName = "aws_instanceaws_vpcaws_vpc_peering_connectionaws_key_pairaws_security_groupaws_subnetaws_ebs_volumeaws_elasticache_clusteraws_elbaws_albaws_alb_listeneraws_alb_listener_ruleaws_alb_listener_certificateaws_alb_target_groupaws_lbaws_lb_listeneraws_lb_listener_ruleaws_lb_listener_certificateaws_lb_target_groupaws_db_instanceaws_db_parameter_groupaws_db_subnet_groupaws_s3_bucketaws_cloudfront_distributionaws_cloudfront_origin_access_identityaws_cloudfront_public_keyaws_cloudwatch_metric_alarmaws_iam_access_keyaws_iam_account_aliasaws_iam_account_password_policyaws_iam_groupaws_iam_group_membershipaws_iam_group_policyaws_iam_group_policy_attachmentaws_iam_instance_profileaws_iam_openid_connect_provideraws_iam_policyaws_iam_roleaws_iam_role_policyaws_iam_role_policy_attachmentaws_iam_saml_provideraws_iam_server_certificateaws_iam_useraws_iam_user_group_membershipaws_iam_user_policyaws_iam_user_policy_attachmentaws_iam_user_ssh_keyaws_route53_delegation_setaws_route53_health_checkaws_route53_query_logaws_route53_recordaws_route53_zoneaws_route53_zone_associationaws_route53_resolver_endpointaws_route53_resolver_rule_associationaws_ses_active_receipt_rule_setaws_ses_domain_identityaws_ses_domain_identity_verificationaws_ses_domain_dkimaws_ses_domain_mail_fromaws_ses_receipt_filteraws_ses_receipt_ruleaws_ses_receipt_rule_setaws_ses_configuration_setaws_ses_identity_notification_topicaws_ses_templateaws_launch_configurationaws_launch_templateaws_autoscaling_groupaws_autoscaling_policy" +const _ResourceTypeName = "aws_instanceaws_albaws_alb_listeneraws_alb_listener_certificateaws_alb_listener_ruleaws_alb_target_groupaws_alb_target_group_attachmentaws_api_gateway_deploymentaws_api_gateway_stageaws_api_gateway_resourceaws_api_gateway_rest_apiaws_autoscaling_groupaws_autoscaling_policyaws_cloudfront_distributionaws_cloudfront_origin_access_identityaws_cloudfront_public_keyaws_cloudwatch_metric_alarmaws_db_instanceaws_db_parameter_groupaws_db_subnet_groupaws_ebs_volumeaws_elasticache_clusteraws_elasticsearch_domainaws_elasticsearch_domain_policyaws_elbaws_iam_access_keyaws_iam_account_aliasaws_iam_account_password_policyaws_iam_groupaws_iam_group_membershipaws_iam_group_policyaws_iam_group_policy_attachmentaws_iam_instance_profileaws_iam_openid_connect_provideraws_iam_policyaws_iam_roleaws_iam_role_policyaws_iam_role_policy_attachmentaws_iam_saml_provideraws_iam_server_certificateaws_iam_useraws_iam_user_group_membershipaws_iam_user_policyaws_iam_user_policy_attachmentaws_iam_user_ssh_keyaws_key_pairaws_lambda_functionaws_launch_configurationaws_launch_templateaws_lbaws_lb_cookie_stickiness_policyaws_lb_listeneraws_lb_listener_certificateaws_lb_listener_ruleaws_lb_target_groupaws_lb_target_group_attachmentaws_route53_delegation_setaws_route53_health_checkaws_route53_query_logaws_route53_recordaws_route53_resolver_endpointaws_route53_resolver_rule_associationaws_route53_zoneaws_route53_zone_associationaws_s3_bucketaws_security_groupaws_ses_active_receipt_rule_setaws_ses_configuration_setaws_ses_domain_dkimaws_ses_domain_identityaws_ses_domain_identity_verificationaws_ses_domain_mail_fromaws_ses_identity_notification_topicaws_ses_receipt_filteraws_ses_receipt_ruleaws_ses_receipt_rule_setaws_ses_templateaws_subnetaws_volume_attachmentaws_vpcaws_vpc_peering_connection" -var _ResourceTypeIndex = [...]uint16{0, 12, 19, 45, 57, 75, 85, 99, 122, 129, 136, 152, 173, 201, 221, 227, 242, 262, 289, 308, 323, 345, 364, 377, 404, 441, 466, 493, 511, 532, 563, 576, 600, 620, 651, 675, 706, 720, 732, 751, 781, 802, 828, 840, 869, 888, 918, 938, 964, 988, 1009, 1027, 1043, 1071, 1100, 1137, 1168, 1191, 1227, 1246, 1270, 1292, 1312, 1336, 1361, 1396, 1412, 1436, 1455, 1476, 1498} +var _ResourceTypeIndex = [...]uint16{0, 12, 19, 35, 63, 84, 104, 135, 161, 182, 206, 230, 251, 273, 300, 337, 362, 389, 404, 426, 445, 459, 482, 506, 537, 544, 562, 583, 614, 627, 651, 671, 702, 726, 757, 771, 783, 802, 832, 853, 879, 891, 920, 939, 969, 989, 1001, 1020, 1044, 1063, 1069, 1100, 1115, 1142, 1162, 1181, 1211, 1237, 1261, 1282, 1300, 1329, 1366, 1382, 1410, 1423, 1441, 1472, 1497, 1516, 1539, 1575, 1599, 1634, 1656, 1676, 1700, 1716, 1726, 1747, 1754, 1780} -const _ResourceTypeLowerName = "aws_instanceaws_vpcaws_vpc_peering_connectionaws_key_pairaws_security_groupaws_subnetaws_ebs_volumeaws_elasticache_clusteraws_elbaws_albaws_alb_listeneraws_alb_listener_ruleaws_alb_listener_certificateaws_alb_target_groupaws_lbaws_lb_listeneraws_lb_listener_ruleaws_lb_listener_certificateaws_lb_target_groupaws_db_instanceaws_db_parameter_groupaws_db_subnet_groupaws_s3_bucketaws_cloudfront_distributionaws_cloudfront_origin_access_identityaws_cloudfront_public_keyaws_cloudwatch_metric_alarmaws_iam_access_keyaws_iam_account_aliasaws_iam_account_password_policyaws_iam_groupaws_iam_group_membershipaws_iam_group_policyaws_iam_group_policy_attachmentaws_iam_instance_profileaws_iam_openid_connect_provideraws_iam_policyaws_iam_roleaws_iam_role_policyaws_iam_role_policy_attachmentaws_iam_saml_provideraws_iam_server_certificateaws_iam_useraws_iam_user_group_membershipaws_iam_user_policyaws_iam_user_policy_attachmentaws_iam_user_ssh_keyaws_route53_delegation_setaws_route53_health_checkaws_route53_query_logaws_route53_recordaws_route53_zoneaws_route53_zone_associationaws_route53_resolver_endpointaws_route53_resolver_rule_associationaws_ses_active_receipt_rule_setaws_ses_domain_identityaws_ses_domain_identity_verificationaws_ses_domain_dkimaws_ses_domain_mail_fromaws_ses_receipt_filteraws_ses_receipt_ruleaws_ses_receipt_rule_setaws_ses_configuration_setaws_ses_identity_notification_topicaws_ses_templateaws_launch_configurationaws_launch_templateaws_autoscaling_groupaws_autoscaling_policy" +const _ResourceTypeLowerName = "aws_instanceaws_albaws_alb_listeneraws_alb_listener_certificateaws_alb_listener_ruleaws_alb_target_groupaws_alb_target_group_attachmentaws_api_gateway_deploymentaws_api_gateway_stageaws_api_gateway_resourceaws_api_gateway_rest_apiaws_autoscaling_groupaws_autoscaling_policyaws_cloudfront_distributionaws_cloudfront_origin_access_identityaws_cloudfront_public_keyaws_cloudwatch_metric_alarmaws_db_instanceaws_db_parameter_groupaws_db_subnet_groupaws_ebs_volumeaws_elasticache_clusteraws_elasticsearch_domainaws_elasticsearch_domain_policyaws_elbaws_iam_access_keyaws_iam_account_aliasaws_iam_account_password_policyaws_iam_groupaws_iam_group_membershipaws_iam_group_policyaws_iam_group_policy_attachmentaws_iam_instance_profileaws_iam_openid_connect_provideraws_iam_policyaws_iam_roleaws_iam_role_policyaws_iam_role_policy_attachmentaws_iam_saml_provideraws_iam_server_certificateaws_iam_useraws_iam_user_group_membershipaws_iam_user_policyaws_iam_user_policy_attachmentaws_iam_user_ssh_keyaws_key_pairaws_lambda_functionaws_launch_configurationaws_launch_templateaws_lbaws_lb_cookie_stickiness_policyaws_lb_listeneraws_lb_listener_certificateaws_lb_listener_ruleaws_lb_target_groupaws_lb_target_group_attachmentaws_route53_delegation_setaws_route53_health_checkaws_route53_query_logaws_route53_recordaws_route53_resolver_endpointaws_route53_resolver_rule_associationaws_route53_zoneaws_route53_zone_associationaws_s3_bucketaws_security_groupaws_ses_active_receipt_rule_setaws_ses_configuration_setaws_ses_domain_dkimaws_ses_domain_identityaws_ses_domain_identity_verificationaws_ses_domain_mail_fromaws_ses_identity_notification_topicaws_ses_receipt_filteraws_ses_receipt_ruleaws_ses_receipt_rule_setaws_ses_templateaws_subnetaws_volume_attachmentaws_vpcaws_vpc_peering_connection" func (i ResourceType) String() string { i -= 1 @@ -20,222 +20,255 @@ func (i ResourceType) String() string { return _ResourceTypeName[_ResourceTypeIndex[i]:_ResourceTypeIndex[i+1]] } -var _ResourceTypeValues = []ResourceType{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70} +var _ResourceTypeValues = []ResourceType{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81} var _ResourceTypeNameToValueMap = map[string]ResourceType{ _ResourceTypeName[0:12]: 1, _ResourceTypeLowerName[0:12]: 1, _ResourceTypeName[12:19]: 2, _ResourceTypeLowerName[12:19]: 2, - _ResourceTypeName[19:45]: 3, - _ResourceTypeLowerName[19:45]: 3, - _ResourceTypeName[45:57]: 4, - _ResourceTypeLowerName[45:57]: 4, - _ResourceTypeName[57:75]: 5, - _ResourceTypeLowerName[57:75]: 5, - _ResourceTypeName[75:85]: 6, - _ResourceTypeLowerName[75:85]: 6, - _ResourceTypeName[85:99]: 7, - _ResourceTypeLowerName[85:99]: 7, - _ResourceTypeName[99:122]: 8, - _ResourceTypeLowerName[99:122]: 8, - _ResourceTypeName[122:129]: 9, - _ResourceTypeLowerName[122:129]: 9, - _ResourceTypeName[129:136]: 10, - _ResourceTypeLowerName[129:136]: 10, - _ResourceTypeName[136:152]: 11, - _ResourceTypeLowerName[136:152]: 11, - _ResourceTypeName[152:173]: 12, - _ResourceTypeLowerName[152:173]: 12, - _ResourceTypeName[173:201]: 13, - _ResourceTypeLowerName[173:201]: 13, - _ResourceTypeName[201:221]: 14, - _ResourceTypeLowerName[201:221]: 14, - _ResourceTypeName[221:227]: 15, - _ResourceTypeLowerName[221:227]: 15, - _ResourceTypeName[227:242]: 16, - _ResourceTypeLowerName[227:242]: 16, - _ResourceTypeName[242:262]: 17, - _ResourceTypeLowerName[242:262]: 17, - _ResourceTypeName[262:289]: 18, - _ResourceTypeLowerName[262:289]: 18, - _ResourceTypeName[289:308]: 19, - _ResourceTypeLowerName[289:308]: 19, - _ResourceTypeName[308:323]: 20, - _ResourceTypeLowerName[308:323]: 20, - _ResourceTypeName[323:345]: 21, - _ResourceTypeLowerName[323:345]: 21, - _ResourceTypeName[345:364]: 22, - _ResourceTypeLowerName[345:364]: 22, - _ResourceTypeName[364:377]: 23, - _ResourceTypeLowerName[364:377]: 23, - _ResourceTypeName[377:404]: 24, - _ResourceTypeLowerName[377:404]: 24, - _ResourceTypeName[404:441]: 25, - _ResourceTypeLowerName[404:441]: 25, - _ResourceTypeName[441:466]: 26, - _ResourceTypeLowerName[441:466]: 26, - _ResourceTypeName[466:493]: 27, - _ResourceTypeLowerName[466:493]: 27, - _ResourceTypeName[493:511]: 28, - _ResourceTypeLowerName[493:511]: 28, - _ResourceTypeName[511:532]: 29, - _ResourceTypeLowerName[511:532]: 29, - _ResourceTypeName[532:563]: 30, - _ResourceTypeLowerName[532:563]: 30, - _ResourceTypeName[563:576]: 31, - _ResourceTypeLowerName[563:576]: 31, - _ResourceTypeName[576:600]: 32, - _ResourceTypeLowerName[576:600]: 32, - _ResourceTypeName[600:620]: 33, - _ResourceTypeLowerName[600:620]: 33, - _ResourceTypeName[620:651]: 34, - _ResourceTypeLowerName[620:651]: 34, - _ResourceTypeName[651:675]: 35, - _ResourceTypeLowerName[651:675]: 35, - _ResourceTypeName[675:706]: 36, - _ResourceTypeLowerName[675:706]: 36, - _ResourceTypeName[706:720]: 37, - _ResourceTypeLowerName[706:720]: 37, - _ResourceTypeName[720:732]: 38, - _ResourceTypeLowerName[720:732]: 38, - _ResourceTypeName[732:751]: 39, - _ResourceTypeLowerName[732:751]: 39, - _ResourceTypeName[751:781]: 40, - _ResourceTypeLowerName[751:781]: 40, - _ResourceTypeName[781:802]: 41, - _ResourceTypeLowerName[781:802]: 41, - _ResourceTypeName[802:828]: 42, - _ResourceTypeLowerName[802:828]: 42, - _ResourceTypeName[828:840]: 43, - _ResourceTypeLowerName[828:840]: 43, - _ResourceTypeName[840:869]: 44, - _ResourceTypeLowerName[840:869]: 44, - _ResourceTypeName[869:888]: 45, - _ResourceTypeLowerName[869:888]: 45, - _ResourceTypeName[888:918]: 46, - _ResourceTypeLowerName[888:918]: 46, - _ResourceTypeName[918:938]: 47, - _ResourceTypeLowerName[918:938]: 47, - _ResourceTypeName[938:964]: 48, - _ResourceTypeLowerName[938:964]: 48, - _ResourceTypeName[964:988]: 49, - _ResourceTypeLowerName[964:988]: 49, - _ResourceTypeName[988:1009]: 50, - _ResourceTypeLowerName[988:1009]: 50, - _ResourceTypeName[1009:1027]: 51, - _ResourceTypeLowerName[1009:1027]: 51, - _ResourceTypeName[1027:1043]: 52, - _ResourceTypeLowerName[1027:1043]: 52, - _ResourceTypeName[1043:1071]: 53, - _ResourceTypeLowerName[1043:1071]: 53, - _ResourceTypeName[1071:1100]: 54, - _ResourceTypeLowerName[1071:1100]: 54, - _ResourceTypeName[1100:1137]: 55, - _ResourceTypeLowerName[1100:1137]: 55, - _ResourceTypeName[1137:1168]: 56, - _ResourceTypeLowerName[1137:1168]: 56, - _ResourceTypeName[1168:1191]: 57, - _ResourceTypeLowerName[1168:1191]: 57, - _ResourceTypeName[1191:1227]: 58, - _ResourceTypeLowerName[1191:1227]: 58, - _ResourceTypeName[1227:1246]: 59, - _ResourceTypeLowerName[1227:1246]: 59, - _ResourceTypeName[1246:1270]: 60, - _ResourceTypeLowerName[1246:1270]: 60, - _ResourceTypeName[1270:1292]: 61, - _ResourceTypeLowerName[1270:1292]: 61, - _ResourceTypeName[1292:1312]: 62, - _ResourceTypeLowerName[1292:1312]: 62, - _ResourceTypeName[1312:1336]: 63, - _ResourceTypeLowerName[1312:1336]: 63, - _ResourceTypeName[1336:1361]: 64, - _ResourceTypeLowerName[1336:1361]: 64, - _ResourceTypeName[1361:1396]: 65, - _ResourceTypeLowerName[1361:1396]: 65, - _ResourceTypeName[1396:1412]: 66, - _ResourceTypeLowerName[1396:1412]: 66, - _ResourceTypeName[1412:1436]: 67, - _ResourceTypeLowerName[1412:1436]: 67, - _ResourceTypeName[1436:1455]: 68, - _ResourceTypeLowerName[1436:1455]: 68, - _ResourceTypeName[1455:1476]: 69, - _ResourceTypeLowerName[1455:1476]: 69, - _ResourceTypeName[1476:1498]: 70, - _ResourceTypeLowerName[1476:1498]: 70, + _ResourceTypeName[19:35]: 3, + _ResourceTypeLowerName[19:35]: 3, + _ResourceTypeName[35:63]: 4, + _ResourceTypeLowerName[35:63]: 4, + _ResourceTypeName[63:84]: 5, + _ResourceTypeLowerName[63:84]: 5, + _ResourceTypeName[84:104]: 6, + _ResourceTypeLowerName[84:104]: 6, + _ResourceTypeName[104:135]: 7, + _ResourceTypeLowerName[104:135]: 7, + _ResourceTypeName[135:161]: 8, + _ResourceTypeLowerName[135:161]: 8, + _ResourceTypeName[161:182]: 9, + _ResourceTypeLowerName[161:182]: 9, + _ResourceTypeName[182:206]: 10, + _ResourceTypeLowerName[182:206]: 10, + _ResourceTypeName[206:230]: 11, + _ResourceTypeLowerName[206:230]: 11, + _ResourceTypeName[230:251]: 12, + _ResourceTypeLowerName[230:251]: 12, + _ResourceTypeName[251:273]: 13, + _ResourceTypeLowerName[251:273]: 13, + _ResourceTypeName[273:300]: 14, + _ResourceTypeLowerName[273:300]: 14, + _ResourceTypeName[300:337]: 15, + _ResourceTypeLowerName[300:337]: 15, + _ResourceTypeName[337:362]: 16, + _ResourceTypeLowerName[337:362]: 16, + _ResourceTypeName[362:389]: 17, + _ResourceTypeLowerName[362:389]: 17, + _ResourceTypeName[389:404]: 18, + _ResourceTypeLowerName[389:404]: 18, + _ResourceTypeName[404:426]: 19, + _ResourceTypeLowerName[404:426]: 19, + _ResourceTypeName[426:445]: 20, + _ResourceTypeLowerName[426:445]: 20, + _ResourceTypeName[445:459]: 21, + _ResourceTypeLowerName[445:459]: 21, + _ResourceTypeName[459:482]: 22, + _ResourceTypeLowerName[459:482]: 22, + _ResourceTypeName[482:506]: 23, + _ResourceTypeLowerName[482:506]: 23, + _ResourceTypeName[506:537]: 24, + _ResourceTypeLowerName[506:537]: 24, + _ResourceTypeName[537:544]: 25, + _ResourceTypeLowerName[537:544]: 25, + _ResourceTypeName[544:562]: 26, + _ResourceTypeLowerName[544:562]: 26, + _ResourceTypeName[562:583]: 27, + _ResourceTypeLowerName[562:583]: 27, + _ResourceTypeName[583:614]: 28, + _ResourceTypeLowerName[583:614]: 28, + _ResourceTypeName[614:627]: 29, + _ResourceTypeLowerName[614:627]: 29, + _ResourceTypeName[627:651]: 30, + _ResourceTypeLowerName[627:651]: 30, + _ResourceTypeName[651:671]: 31, + _ResourceTypeLowerName[651:671]: 31, + _ResourceTypeName[671:702]: 32, + _ResourceTypeLowerName[671:702]: 32, + _ResourceTypeName[702:726]: 33, + _ResourceTypeLowerName[702:726]: 33, + _ResourceTypeName[726:757]: 34, + _ResourceTypeLowerName[726:757]: 34, + _ResourceTypeName[757:771]: 35, + _ResourceTypeLowerName[757:771]: 35, + _ResourceTypeName[771:783]: 36, + _ResourceTypeLowerName[771:783]: 36, + _ResourceTypeName[783:802]: 37, + _ResourceTypeLowerName[783:802]: 37, + _ResourceTypeName[802:832]: 38, + _ResourceTypeLowerName[802:832]: 38, + _ResourceTypeName[832:853]: 39, + _ResourceTypeLowerName[832:853]: 39, + _ResourceTypeName[853:879]: 40, + _ResourceTypeLowerName[853:879]: 40, + _ResourceTypeName[879:891]: 41, + _ResourceTypeLowerName[879:891]: 41, + _ResourceTypeName[891:920]: 42, + _ResourceTypeLowerName[891:920]: 42, + _ResourceTypeName[920:939]: 43, + _ResourceTypeLowerName[920:939]: 43, + _ResourceTypeName[939:969]: 44, + _ResourceTypeLowerName[939:969]: 44, + _ResourceTypeName[969:989]: 45, + _ResourceTypeLowerName[969:989]: 45, + _ResourceTypeName[989:1001]: 46, + _ResourceTypeLowerName[989:1001]: 46, + _ResourceTypeName[1001:1020]: 47, + _ResourceTypeLowerName[1001:1020]: 47, + _ResourceTypeName[1020:1044]: 48, + _ResourceTypeLowerName[1020:1044]: 48, + _ResourceTypeName[1044:1063]: 49, + _ResourceTypeLowerName[1044:1063]: 49, + _ResourceTypeName[1063:1069]: 50, + _ResourceTypeLowerName[1063:1069]: 50, + _ResourceTypeName[1069:1100]: 51, + _ResourceTypeLowerName[1069:1100]: 51, + _ResourceTypeName[1100:1115]: 52, + _ResourceTypeLowerName[1100:1115]: 52, + _ResourceTypeName[1115:1142]: 53, + _ResourceTypeLowerName[1115:1142]: 53, + _ResourceTypeName[1142:1162]: 54, + _ResourceTypeLowerName[1142:1162]: 54, + _ResourceTypeName[1162:1181]: 55, + _ResourceTypeLowerName[1162:1181]: 55, + _ResourceTypeName[1181:1211]: 56, + _ResourceTypeLowerName[1181:1211]: 56, + _ResourceTypeName[1211:1237]: 57, + _ResourceTypeLowerName[1211:1237]: 57, + _ResourceTypeName[1237:1261]: 58, + _ResourceTypeLowerName[1237:1261]: 58, + _ResourceTypeName[1261:1282]: 59, + _ResourceTypeLowerName[1261:1282]: 59, + _ResourceTypeName[1282:1300]: 60, + _ResourceTypeLowerName[1282:1300]: 60, + _ResourceTypeName[1300:1329]: 61, + _ResourceTypeLowerName[1300:1329]: 61, + _ResourceTypeName[1329:1366]: 62, + _ResourceTypeLowerName[1329:1366]: 62, + _ResourceTypeName[1366:1382]: 63, + _ResourceTypeLowerName[1366:1382]: 63, + _ResourceTypeName[1382:1410]: 64, + _ResourceTypeLowerName[1382:1410]: 64, + _ResourceTypeName[1410:1423]: 65, + _ResourceTypeLowerName[1410:1423]: 65, + _ResourceTypeName[1423:1441]: 66, + _ResourceTypeLowerName[1423:1441]: 66, + _ResourceTypeName[1441:1472]: 67, + _ResourceTypeLowerName[1441:1472]: 67, + _ResourceTypeName[1472:1497]: 68, + _ResourceTypeLowerName[1472:1497]: 68, + _ResourceTypeName[1497:1516]: 69, + _ResourceTypeLowerName[1497:1516]: 69, + _ResourceTypeName[1516:1539]: 70, + _ResourceTypeLowerName[1516:1539]: 70, + _ResourceTypeName[1539:1575]: 71, + _ResourceTypeLowerName[1539:1575]: 71, + _ResourceTypeName[1575:1599]: 72, + _ResourceTypeLowerName[1575:1599]: 72, + _ResourceTypeName[1599:1634]: 73, + _ResourceTypeLowerName[1599:1634]: 73, + _ResourceTypeName[1634:1656]: 74, + _ResourceTypeLowerName[1634:1656]: 74, + _ResourceTypeName[1656:1676]: 75, + _ResourceTypeLowerName[1656:1676]: 75, + _ResourceTypeName[1676:1700]: 76, + _ResourceTypeLowerName[1676:1700]: 76, + _ResourceTypeName[1700:1716]: 77, + _ResourceTypeLowerName[1700:1716]: 77, + _ResourceTypeName[1716:1726]: 78, + _ResourceTypeLowerName[1716:1726]: 78, + _ResourceTypeName[1726:1747]: 79, + _ResourceTypeLowerName[1726:1747]: 79, + _ResourceTypeName[1747:1754]: 80, + _ResourceTypeLowerName[1747:1754]: 80, + _ResourceTypeName[1754:1780]: 81, + _ResourceTypeLowerName[1754:1780]: 81, } var _ResourceTypeNames = []string{ _ResourceTypeName[0:12], _ResourceTypeName[12:19], - _ResourceTypeName[19:45], - _ResourceTypeName[45:57], - _ResourceTypeName[57:75], - _ResourceTypeName[75:85], - _ResourceTypeName[85:99], - _ResourceTypeName[99:122], - _ResourceTypeName[122:129], - _ResourceTypeName[129:136], - _ResourceTypeName[136:152], - _ResourceTypeName[152:173], - _ResourceTypeName[173:201], - _ResourceTypeName[201:221], - _ResourceTypeName[221:227], - _ResourceTypeName[227:242], - _ResourceTypeName[242:262], - _ResourceTypeName[262:289], - _ResourceTypeName[289:308], - _ResourceTypeName[308:323], - _ResourceTypeName[323:345], - _ResourceTypeName[345:364], - _ResourceTypeName[364:377], - _ResourceTypeName[377:404], - _ResourceTypeName[404:441], - _ResourceTypeName[441:466], - _ResourceTypeName[466:493], - _ResourceTypeName[493:511], - _ResourceTypeName[511:532], - _ResourceTypeName[532:563], - _ResourceTypeName[563:576], - _ResourceTypeName[576:600], - _ResourceTypeName[600:620], - _ResourceTypeName[620:651], - _ResourceTypeName[651:675], - _ResourceTypeName[675:706], - _ResourceTypeName[706:720], - _ResourceTypeName[720:732], - _ResourceTypeName[732:751], - _ResourceTypeName[751:781], - _ResourceTypeName[781:802], - _ResourceTypeName[802:828], - _ResourceTypeName[828:840], - _ResourceTypeName[840:869], - _ResourceTypeName[869:888], - _ResourceTypeName[888:918], - _ResourceTypeName[918:938], - _ResourceTypeName[938:964], - _ResourceTypeName[964:988], - _ResourceTypeName[988:1009], - _ResourceTypeName[1009:1027], - _ResourceTypeName[1027:1043], - _ResourceTypeName[1043:1071], - _ResourceTypeName[1071:1100], - _ResourceTypeName[1100:1137], - _ResourceTypeName[1137:1168], - _ResourceTypeName[1168:1191], - _ResourceTypeName[1191:1227], - _ResourceTypeName[1227:1246], - _ResourceTypeName[1246:1270], - _ResourceTypeName[1270:1292], - _ResourceTypeName[1292:1312], - _ResourceTypeName[1312:1336], - _ResourceTypeName[1336:1361], - _ResourceTypeName[1361:1396], - _ResourceTypeName[1396:1412], - _ResourceTypeName[1412:1436], - _ResourceTypeName[1436:1455], - _ResourceTypeName[1455:1476], - _ResourceTypeName[1476:1498], + _ResourceTypeName[19:35], + _ResourceTypeName[35:63], + _ResourceTypeName[63:84], + _ResourceTypeName[84:104], + _ResourceTypeName[104:135], + _ResourceTypeName[135:161], + _ResourceTypeName[161:182], + _ResourceTypeName[182:206], + _ResourceTypeName[206:230], + _ResourceTypeName[230:251], + _ResourceTypeName[251:273], + _ResourceTypeName[273:300], + _ResourceTypeName[300:337], + _ResourceTypeName[337:362], + _ResourceTypeName[362:389], + _ResourceTypeName[389:404], + _ResourceTypeName[404:426], + _ResourceTypeName[426:445], + _ResourceTypeName[445:459], + _ResourceTypeName[459:482], + _ResourceTypeName[482:506], + _ResourceTypeName[506:537], + _ResourceTypeName[537:544], + _ResourceTypeName[544:562], + _ResourceTypeName[562:583], + _ResourceTypeName[583:614], + _ResourceTypeName[614:627], + _ResourceTypeName[627:651], + _ResourceTypeName[651:671], + _ResourceTypeName[671:702], + _ResourceTypeName[702:726], + _ResourceTypeName[726:757], + _ResourceTypeName[757:771], + _ResourceTypeName[771:783], + _ResourceTypeName[783:802], + _ResourceTypeName[802:832], + _ResourceTypeName[832:853], + _ResourceTypeName[853:879], + _ResourceTypeName[879:891], + _ResourceTypeName[891:920], + _ResourceTypeName[920:939], + _ResourceTypeName[939:969], + _ResourceTypeName[969:989], + _ResourceTypeName[989:1001], + _ResourceTypeName[1001:1020], + _ResourceTypeName[1020:1044], + _ResourceTypeName[1044:1063], + _ResourceTypeName[1063:1069], + _ResourceTypeName[1069:1100], + _ResourceTypeName[1100:1115], + _ResourceTypeName[1115:1142], + _ResourceTypeName[1142:1162], + _ResourceTypeName[1162:1181], + _ResourceTypeName[1181:1211], + _ResourceTypeName[1211:1237], + _ResourceTypeName[1237:1261], + _ResourceTypeName[1261:1282], + _ResourceTypeName[1282:1300], + _ResourceTypeName[1300:1329], + _ResourceTypeName[1329:1366], + _ResourceTypeName[1366:1382], + _ResourceTypeName[1382:1410], + _ResourceTypeName[1410:1423], + _ResourceTypeName[1423:1441], + _ResourceTypeName[1441:1472], + _ResourceTypeName[1472:1497], + _ResourceTypeName[1497:1516], + _ResourceTypeName[1516:1539], + _ResourceTypeName[1539:1575], + _ResourceTypeName[1575:1599], + _ResourceTypeName[1599:1634], + _ResourceTypeName[1634:1656], + _ResourceTypeName[1656:1676], + _ResourceTypeName[1676:1700], + _ResourceTypeName[1700:1716], + _ResourceTypeName[1716:1726], + _ResourceTypeName[1726:1747], + _ResourceTypeName[1747:1754], + _ResourceTypeName[1754:1780], } // ResourceTypeString retrieves an enum value from the enum constants string name.