This repository has been archived by the owner on Aug 16, 2022. It is now read-only.
/
applications.go
131 lines (127 loc) · 5.27 KB
/
applications.go
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
package elasticbeanstalk
import (
"context"
"github.com/aws/aws-sdk-go-v2/service/elasticbeanstalk"
"github.com/cloudquery/cq-provider-aws/client"
"github.com/cloudquery/cq-provider-sdk/provider/diag"
"github.com/cloudquery/cq-provider-sdk/provider/schema"
)
func ElasticbeanstalkApplications() *schema.Table {
return &schema.Table{
Name: "aws_elasticbeanstalk_applications",
Description: "Describes the properties of an application.",
Resolver: fetchElasticbeanstalkApplications,
Multiplex: client.ServiceAccountRegionMultiplexer("elasticbeanstalk"),
IgnoreError: client.IgnoreAccessDeniedServiceDisabled,
DeleteFilter: client.DeleteAccountRegionFilter,
Options: schema.TableCreationOptions{PrimaryKeys: []string{"arn", "date_created"}},
IgnoreInTests: true,
Columns: []schema.Column{
{
Name: "account_id",
Description: "The AWS Account ID of the resource.",
Type: schema.TypeString,
Resolver: client.ResolveAWSAccount,
},
{
Name: "region",
Description: "The AWS Region of the resource.",
Type: schema.TypeString,
Resolver: client.ResolveAWSRegion,
},
{
Name: "arn",
Description: "The Amazon Resource Name (ARN) of the application.",
Type: schema.TypeString,
Resolver: schema.PathResolver("ApplicationArn"),
},
{
Name: "name",
Description: "The name of the application.",
Type: schema.TypeString,
Resolver: schema.PathResolver("ApplicationName"),
},
{
Name: "configuration_templates",
Description: "The names of the configuration templates associated with this application.",
Type: schema.TypeStringArray,
},
{
Name: "date_created",
Description: "The date when the application was created.",
Type: schema.TypeTimestamp,
},
{
Name: "date_updated",
Description: "The date when the application was last modified.",
Type: schema.TypeTimestamp,
},
{
Name: "description",
Description: "User-defined description of the application.",
Type: schema.TypeString,
},
{
Name: "resource_lifecycle_config_service_role",
Description: "The ARN of an IAM service role that Elastic Beanstalk has permission to assume. The ServiceRole property is required the first time that you provide a VersionLifecycleConfig for the application in one of the supporting calls (CreateApplication or UpdateApplicationResourceLifecycle)",
Type: schema.TypeString,
Resolver: schema.PathResolver("ResourceLifecycleConfig.ServiceRole"),
},
{
Name: "max_age_rule_enabled",
Description: "Specify true to apply the rule, or false to disable it. ",
Type: schema.TypeBool,
Resolver: schema.PathResolver("ResourceLifecycleConfig.VersionLifecycleConfig.MaxAgeRule.Enabled"),
},
{
Name: "max_age_rule_delete_source_from_s3",
Description: "Set to true to delete a version's source bundle from Amazon S3 when Elastic Beanstalk deletes the application version.",
Type: schema.TypeBool,
Resolver: schema.PathResolver("ResourceLifecycleConfig.VersionLifecycleConfig.MaxAgeRule.DeleteSourceFromS3"),
},
{
Name: "max_age_rule_max_age_in_days",
Description: "Specify the number of days to retain an application versions.",
Type: schema.TypeInt,
Resolver: schema.PathResolver("ResourceLifecycleConfig.VersionLifecycleConfig.MaxAgeRule.MaxAgeInDays"),
},
{
Name: "max_count_rule_enabled",
Description: "Specify true to apply the rule, or false to disable it. ",
Type: schema.TypeBool,
Resolver: schema.PathResolver("ResourceLifecycleConfig.VersionLifecycleConfig.MaxCountRule.Enabled"),
},
{
Name: "max_count_rule_delete_source_from_s3",
Description: "Set to true to delete a version's source bundle from Amazon S3 when Elastic Beanstalk deletes the application version.",
Type: schema.TypeBool,
Resolver: schema.PathResolver("ResourceLifecycleConfig.VersionLifecycleConfig.MaxCountRule.DeleteSourceFromS3"),
},
{
Name: "max_count_rule_max_count",
Description: "Specify the maximum number of application versions to retain.",
Type: schema.TypeInt,
Resolver: schema.PathResolver("ResourceLifecycleConfig.VersionLifecycleConfig.MaxCountRule.MaxCount"),
},
{
Name: "versions",
Description: "The names of the versions for this application.",
Type: schema.TypeStringArray,
},
},
}
}
// ====================================================================================================================
// Table Resolver Functions
// ====================================================================================================================
func fetchElasticbeanstalkApplications(ctx context.Context, meta schema.ClientMeta, parent *schema.Resource, res chan<- interface{}) error {
var config elasticbeanstalk.DescribeApplicationsInput
c := meta.(*client.Client)
svc := c.Services().ElasticBeanstalk
output, err := svc.DescribeApplications(ctx, &config)
if err != nil {
return diag.WrapError(err)
}
res <- output.Applications
return nil
}