@@ -18,16 +18,23 @@ import (
18
18
func RegisterSweepers () {
19
19
awsv2 .Register ("aws_datazone_domain" , sweepDomains ,
20
20
"aws_datazone_project" ,
21
+ "aws_datazone_environment_profile" ,
21
22
)
22
23
23
- awsv2 .Register ("aws_datazone_project" , sweepProjects )
24
+ awsv2 .Register ("aws_datazone_environment" , sweepEnvironments )
25
+
26
+ awsv2 .Register ("aws_datazone_environment_profile" , sweepEnvironmentProfiles )
27
+
28
+ awsv2 .Register ("aws_datazone_project" , sweepProjects ,
29
+ "aws_datazone_environment" ,
30
+ )
24
31
}
25
32
26
33
func sweepDomains (ctx context.Context , client * conns.AWSClient ) ([]sweep.Sweepable , error ) {
27
34
conn := client .DataZoneClient (ctx )
28
35
var sweepResources []sweep.Sweepable
29
36
30
- input := datazone.ListDomainsInput {}
37
+ var input datazone.ListDomainsInput
31
38
pages := datazone .NewListDomainsPaginator (conn , & input )
32
39
for pages .HasMorePages () {
33
40
page , err := pages .NextPage (ctx )
@@ -47,11 +54,97 @@ func sweepDomains(ctx context.Context, client *conns.AWSClient) ([]sweep.Sweepab
47
54
return sweepResources , nil
48
55
}
49
56
57
+ func sweepEnvironments (ctx context.Context , client * conns.AWSClient ) ([]sweep.Sweepable , error ) {
58
+ conn := client .DataZoneClient (ctx )
59
+ var sweepResources []sweep.Sweepable
60
+
61
+ var domainsInput datazone.ListDomainsInput
62
+ pages := datazone .NewListDomainsPaginator (conn , & domainsInput )
63
+ for pages .HasMorePages () {
64
+ page , err := pages .NextPage (ctx )
65
+ if err != nil {
66
+ return nil , err
67
+ }
68
+
69
+ for _ , domain := range page .Items {
70
+ projectsInput := datazone.ListProjectsInput {
71
+ DomainIdentifier : domain .Id ,
72
+ }
73
+ pages := datazone .NewListProjectsPaginator (conn , & projectsInput )
74
+ for pages .HasMorePages () {
75
+ page , err := pages .NextPage (ctx )
76
+ if err != nil {
77
+ return nil , err
78
+ }
79
+
80
+ for _ , project := range page .Items {
81
+ environmentsInput := datazone.ListEnvironmentsInput {
82
+ DomainIdentifier : domain .Id ,
83
+ ProjectIdentifier : project .Id ,
84
+ }
85
+ pages := datazone .NewListEnvironmentsPaginator (conn , & environmentsInput )
86
+ for pages .HasMorePages () {
87
+ page , err := pages .NextPage (ctx )
88
+ if err != nil {
89
+ return nil , err
90
+ }
91
+
92
+ for _ , environment := range page .Items {
93
+ sweepResources = append (sweepResources , framework .NewSweepResource (newEnvironmentResource , client ,
94
+ framework .NewAttribute (names .AttrID , environment .Id ),
95
+ framework .NewAttribute ("domain_identifier" , domain .Id ),
96
+ ))
97
+ }
98
+ }
99
+ }
100
+ }
101
+ }
102
+ }
103
+
104
+ return sweepResources , nil
105
+ }
106
+
107
+ func sweepEnvironmentProfiles (ctx context.Context , client * conns.AWSClient ) ([]sweep.Sweepable , error ) {
108
+ conn := client .DataZoneClient (ctx )
109
+ var sweepResources []sweep.Sweepable
110
+
111
+ var domainsInput datazone.ListDomainsInput
112
+ pages := datazone .NewListDomainsPaginator (conn , & domainsInput )
113
+ for pages .HasMorePages () {
114
+ page , err := pages .NextPage (ctx )
115
+ if err != nil {
116
+ return nil , err
117
+ }
118
+
119
+ for _ , domain := range page .Items {
120
+ environmentProfilesInput := datazone.ListEnvironmentProfilesInput {
121
+ DomainIdentifier : domain .Id ,
122
+ }
123
+ pages := datazone .NewListEnvironmentProfilesPaginator (conn , & environmentProfilesInput )
124
+ for pages .HasMorePages () {
125
+ page , err := pages .NextPage (ctx )
126
+ if err != nil {
127
+ return nil , err
128
+ }
129
+
130
+ for _ , profile := range page .Items {
131
+ sweepResources = append (sweepResources , framework .NewSweepResource (newEnvironmentProfileResource , client ,
132
+ framework .NewAttribute (names .AttrID , profile .Id ),
133
+ framework .NewAttribute ("domain_identifier" , domain .Id ),
134
+ ))
135
+ }
136
+ }
137
+ }
138
+ }
139
+
140
+ return sweepResources , nil
141
+ }
142
+
50
143
func sweepProjects (ctx context.Context , client * conns.AWSClient ) ([]sweep.Sweepable , error ) {
51
144
conn := client .DataZoneClient (ctx )
52
145
var sweepResources []sweep.Sweepable
53
146
54
- domainsInput := datazone.ListDomainsInput {}
147
+ var domainsInput datazone.ListDomainsInput
55
148
pages := datazone .NewListDomainsPaginator (conn , & domainsInput )
56
149
for pages .HasMorePages () {
57
150
page , err := pages .NextPage (ctx )
@@ -74,7 +167,7 @@ func sweepProjects(ctx context.Context, client *conns.AWSClient) ([]sweep.Sweepa
74
167
sweepResources = append (sweepResources , framework .NewSweepResource (newProjectResource , client ,
75
168
framework .NewAttribute (names .AttrID , project .Id ),
76
169
framework .NewAttribute ("domain_identifier" , domain .Id ),
77
- framework .NewAttribute ("skip_deletion_check" , true ),
170
+ framework .NewAttribute ("skip_deletion_check" , true ), // Automatically delete associated Glossaries
78
171
))
79
172
}
80
173
}
0 commit comments