-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Generates
waitTagsPropagated
if needed and calls it from updateTags
- Loading branch information
Showing
20 changed files
with
381 additions
and
110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
internal/generate/tags/templates/v1/wait_tags_propagated_body.tmpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// {{ .WaitTagsPropagatedFunc }} waits for {{ .ServicePackage }} service tags to be propagated. | ||
// The identifier is typically the Amazon Resource Name (ARN), although | ||
// it may also be a different identifier depending on the service. | ||
func {{ .WaitTagsPropagatedFunc }}(ctx context.Context, conn {{ .ClientType }}, id string, tags tftags.KeyValueTags) error { | ||
checkFunc := func() (bool, error) { | ||
output, err := listTags(ctx, conn, id) | ||
|
||
if tfresource.NotFound(err) { | ||
return false, nil | ||
} | ||
|
||
if err != nil { | ||
return false, err | ||
} | ||
|
||
return output.Equal(tags), nil | ||
} | ||
opts := tfresource.WaitOpts{ | ||
{{- if ne .WaitContinuousOccurence 0 }} | ||
ContinuousTargetOccurence: {{ .WaitContinuousOccurence }}, | ||
{{- end }} | ||
{{- if ne .WaitDelay "" }} | ||
Delay: {{ .WaitDelay }}, | ||
{{- end }} | ||
{{- if ne .WaitMinTimeout "" }} | ||
MinTimeout: {{ .WaitMinTimeout }}, | ||
{{- end }} | ||
{{- if ne .WaitPollInterval "" }} | ||
PollInterval: {{ .WaitPollInterval }}, | ||
{{- end }} | ||
} | ||
|
||
return tfresource.WaitUntil(ctx, {{ .WaitTimeout }}, checkFunc, opts) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
internal/generate/tags/templates/v2/wait_tags_propagated_body.tmpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// {{ .WaitTagsPropagatedFunc }} waits for {{ .ServicePackage }} service tags to be propagated. | ||
// The identifier is typically the Amazon Resource Name (ARN), although | ||
// it may also be a different identifier depending on the service. | ||
func {{ .WaitTagsPropagatedFunc }}(ctx context.Context, conn {{ .ClientType }}, id string, tags tftags.KeyValueTags) error { | ||
checkFunc := func() (bool, error) { | ||
output, err := listTags(ctx, conn, id) | ||
|
||
if tfresource.NotFound(err) { | ||
return false, nil | ||
} | ||
|
||
if err != nil { | ||
return false, err | ||
} | ||
|
||
return output.Equal(tags), nil | ||
} | ||
opts := tfresource.WaitOpts{ | ||
{{- if ne .WaitContinuousOccurence 0 }} | ||
ContinuousTargetOccurence: {{ .WaitContinuousOccurence }}, | ||
{{- end }} | ||
{{- if ne .WaitDelay "" }} | ||
Delay: {{ .WaitDelay }}, | ||
{{- end }} | ||
{{- if ne .WaitMinTimeout "" }} | ||
MinTimeout: {{ .WaitMinTimeout }}, | ||
{{- end }} | ||
{{- if ne .WaitPollInterval "" }} | ||
PollInterval: {{ .WaitPollInterval }}, | ||
{{- end }} | ||
} | ||
|
||
return tfresource.WaitUntil(ctx, {{ .WaitTimeout }}, checkFunc, opts) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.